pelican-plugins / liquid-tags Goto Github PK
View Code? Open in Web Editor NEWPelican plugin that supports Liquid-style tags in Markdown
Pelican plugin that supports Liquid-style tags in Markdown
On my test website, following pelican configuration:
MARKDOWN = {
'extension_configs': {
'markdown.extensions.toc': {'anchorlink': True},
},
'output_format': 'html',
}
LIQUID_TAGS = ["notebook"]
causes multiple (but not all) pages to fail with following error message:
ERROR: Could not process pages/site-policy.md
| append() argument must be xml.etree.ElementTree.Element, not Element
|___
| Traceback (most recent call last):
| File "/tmp/venv-website/lib/python3.9/site-packages/pelican/generators.py", line 721, in generate_context
| page = self.readers.read_file(
| File "/tmp/venv-website/lib/python3.9/site-packages/pelican/readers.py", line 573, in read_file
| content, reader_metadata = reader.read(path)
| File "/tmp/venv-website/lib/python3.9/site-packages/pelican/readers.py", line 337, in read
| content = self._md.convert(text)
| File "/tmp/venv-website/lib/python3.9/site-packages/markdown/core.py", line 268, in convert
| newRoot = treeprocessor.run(root)
| File "/tmp/venv-website/lib/python3.9/site-packages/markdown/extensions/toc.py", line 295, in run
| self.add_anchor(el, el.attrib["id"])
| File "/tmp/venv-website/lib/python3.9/site-packages/markdown/extensions/toc.py", line 218, in add_anchor
| c.append(anchor)
| TypeError: append() argument must be xml.etree.ElementTree.Element, not Element
Not using toc markdown extension or not using notebook liquid tag makes all pages render again, which means that these two sometimes interact in unexpected way.
Root cause should be identified and issue must be fixed, so users are free to use both toc extension and notebook tag on their blogs.
Notebook tag contains couple of templates for various IPython versions; however, new-ish IPython seems to resolve template names relative to one of many pre-specified directories, and liquid_tags plugin directory is not on that list.
Relevant code has been commented out (see pelican/plugins/liquid_tags/notebook.py
line 330) to allow tag to work at all, but support for templates should be brought back.
Generates an error:
ERROR Could not process content/test.md log.py:96
LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'
Done: Processed 0 articles, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages and 0 draft pages in 0.09 seconds.
Is it possible to include an explanation about liquid tags and what is so special about them in the project description (README.md)?
It looks like a tag addition, but I can't extract their clear purpose from the description.
I hope this is a simple request, it will be useful and informational to the user unfamilair with liquid tags.
Thanks.
I followed the installation instructions with the command:
python -m pip install pelican-liquid-tags
and received the following output:
ERROR: Could not find a version that satisfies the requirement pelican-liquid-tags
ERROR: No matching distribution found for pelican-liquid-tags
I'm running:
Right now the plugin as-is pulls in a lot of dependencies that may not be necessary. I want to use include_code
for example, but I don't need anything from ipython or Jupyter.
Would it be possible to make it an optional feature ala this SO post?
pelican/plugins/liquid_tags/include_code.py
line 100 refers to content
directory, assuming it is name of main directory where Pelican will look for content. It should use PATH
variable from Pelican settings. However, tags don't have access to all Pelican settings.
A solution should be found, so tag works with path as specified in pelicanconf.py
, and not only default Pelican content path.
I am using liquid_tags for embedded YT videos (or rather their thumbnails) and 'yafg' Markdown extension to handle images.
This way Markdown snippet:
![NEC PC-8001A with peripherals](/files/2018/07/nec-pc-8001a-700x.jpg "NEC PC-8001A with peripherals")
Turns into:
<figure id="__yafg-figure-12">
<img alt="NEC PC-8001A with peripherals" src="[/files/2018/07/nec-pc-8001a-700x.jpg](view-source:http://localhost:8000/files/2018/07/nec-pc-8001a-700x.jpg)" title="NEC PC-8001A with peripherals">
<figcaption><span class="caps">NEC</span> <span class="caps">PC</span>-8001A with peripherals</figcaption>
</figure>
Which then looks like this (with a bit of CSS used):
figcaption {
text-align: center;
}
figure {
margin: 0 0 0.5em 0;
padding: 0 0.5em 0.5em 0.5em;
border: 1px solid lightgray;
}
But that's duplication of code in Pelican setup so maybe adding <figure> support into liquid_tags.img would be a better option?
After adding Python 3.11 to CI versions, run failed:
Traceback (most recent call last):
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/bin/invoke", line 8, in <module>
sys.exit(program.run())
^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/program.py", line 373, in run
self.parse_collection()
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/program.py", line 465, in parse_collection
self.load_collection()
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/program.py", line 699, in load_collection
module, parent = loader.load(coll_name)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/loader.py", line 76, in load
module = imp.load_module(name, fd, path, desc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/imp.py", line 235, in load_module
return load_source(name, filename, file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.0/x64/lib/python3.11/imp.py", line 172, in load_source
module = _load(spec)
^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 721, in _load
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/runner/work/liquid-tags/liquid-tags/tasks.py", line 25, in <module>
@task
^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 331, in task
return klass(args[0], **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 76, in __init__
self.positional = self.fill_implicit_positionals(positional)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 167, in fill_implicit_positionals
args, spec_dict = self.argspec(self.body)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/.cache/pypoetry/virtualenvs/pelican-liquid-tags-aUA_7FYk-py3.11/lib/python3.11/site-packages/invoke/tasks.py", line 153, in argspec
spec = inspect.getargspec(func)
^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
Error: Process completed with exit code 1.
This issue needs to be investigated and fixed.
Right now, in-tree tags documentation is duplicated in Readme.md and each tag source file docstring. As is usually a case for duplicated content, of course it has diverged over time
YOUTUBE_THUMB_ONLY
and YOUTUBE_THUMB_SIZE
variables)This issue can be closed when we have single source of truth for all tags documentation, and that documentation is up to date.
Personally I would explore generating all docs from docstrings using sphinx, and creating readthedocs account to store that, but I am open to other solutions, too.
I'm getting this error on a site created with blog-o-matic template.
(pelican) C:\Users\Matt\web\mhw.com-elegant>pelican
[10:01:44] WARNING Removed extraneous trailing slash from SITEURL. log.py:91
WARNING Feeds generated without SITEURL set properly may not be valid log.py:91
ERROR Cannot register plugin `tipue_search` log.py:96
module 'tipue_search' has no attribute 'register'
[10:01:46] ERROR Could not process Linux\change-dir-name-case.md log.py:96
LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'
ERROR Could not process Projects\Canvec\Using_CanVec.md log.py:96
LiquidTags.extendMarkdown() missing 1 required positional argument: 'md_globals'
...repeats for each document in content
.
Versions:
I don't know how to get the installed liquid_tags version, so can't tell if the fix in #20 is present.
Hi, the settings YOUTUBE_THUMB_ONLY
and YOUTUBE_THUMB_SIZE
of the Youtube tag have no effect on the behavior of the plugin, in fact they have not been declared in the file mdx_liquid_tags as for the other plugins.
In the documentation it is noted that these parameters must be added to the Pelican configuration but not in the form "Out-of-tree tag".
This is a ticket to keep track of the packaging and PyPi distribution of the next version:
Python: 3.10.8
Pelican: 4.8.0
liquid-tags: 1.0.3
Plugins that I enabled:
PLUGINS = [
"pelican.plugins.liquid_tags.notebook",
"pelican.plugins.liquid_tags.include_code",
"pelican.plugins.jinja_filters",
"pelican.plugins.jinja2content",
"pelican.plugins.simple_footnotes",
"pelican.plugins.render_math",
"pelican.plugins.webassets",
"minify",
]
Accordingly liquid tags:
LIQUID_TAGS = [
"notebook",
"include_code",
]
And then I created code
subfolder under content
, and add this line to a post
{% include_code test.py %}
when building such content, pelican raised an warning that:
Could not process Cate/test-post.md
Encountered unknown tag 'include_code'.
And I've tested on several other tags, and none of them would work. Really don't have an idea about what's going wrong
Instagram tag uses old API endpoint, that has been discontinued by Facebook in October 2020. There are supported alternatives, including (new) oEmbed API and Basic Display API, but they are more involved than old API - apparently they require registering your app within Facebook.
Someone with Instagram account is needed to port tag to new API, and document new procedure of using the tag.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.