This extension adds YAML meta data handling to markdown with all YAML features.
As in the original, metadata is parsed but not used in processing.
Metadata parsed as is by PyYaml and without additional transformations, so this plugin is not compatible with original Meta-Data extension.
import markdown text = """--- title: What is Lorem Ipsum? categories: - Lorem Ipsum - Stupid content ... Lorem Ipsum is simply dummy text. """ md = markdown.Markdown(extensions=['full_yaml_metadata']}) md.convert(text) == '<p>Lorem Ipsum is simply dummy text.</p>' md.Meta == {'title': 'What is Lorem Ipsum?', 'categories': ['Lorem Ipsum', 'Stupid content']}Specify a custom YAML loader
By default the full YAML loader is used for parsing, which is insecure when used with untrusted user data. In such cases, you may want to specify a different loader such as yaml.SafeLoader
using the extension_configs
keyword argument:
import markdown import yaml md = markdown.Markdown(extensions=['full_yaml_metadata']}, extension_configs={ "full_yaml_metadata": { "yaml_loader": yaml.SafeLoader, }, }, )Development and contribution
First of all you should install Poetry.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4