YAML metadata extension for Python-Markdown
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.
Basic Usage
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.
- install project dependencies
make install
- run linters
make lint
- run tests
make test
- feel free to contribute!
Release files for markdown-full-yaml-metadata 2.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| markdown_full_yaml_metadata-2.2.1.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| markdown_full_yaml_metadata-2.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / markdown_full_yaml_metadata-2.2.1.tar.gz
| Download URL | markdown_full_yaml_metadata-2.2.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe5255ba5c8e25454d61f348a6f909a5335f38af281e84ae8f71664aee63451b
|
|
BLAKE2b-256 checksum How to use checksums |
9dee3bddb4995861ea2f884178adbbd605d1f7b8a88856aaf981210fc4877a32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure
|
Release files / markdown_full_yaml_metadata-2.2.1-py3-none-any.whl
| Download URL | markdown_full_yaml_metadata-2.2.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24efececbe660b9acc79558094ae7cbd0da7748bb7799449c57b9f1a1830c76c
|
|
BLAKE2b-256 checksum How to use checksums |
ab1a63742bfc3a4567deaf0ac9438df1564441962f84da8b9eb123c4ff91b01c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1024-azure
|