Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Metadata support for markdown

Project Description

This extension adds a metadata format to the markdown language.

Meta data is a datastructure defined in Yaml at the very beginning of the markdown file. The Yaml content must be put between --- Yaml separator.

A first separator must be set on the very first line of the file to enable metadata parsing. A closing --- line will end the metadata block.

The metadata will not be rendered on the final genrated HTML document.

---

author: John Doe
tags:
  - random tag
  - other tag

---

To enable this extension, it need to be registered in the markdown.Markdown instance. Once a document is parsed, the yaml content can be access through a meta attribute added to the markdown instance.

>>> from markdown import Markdown
>>> md = Markdown(extensions=['markdown_meta'])
>>> f = open('my-markdown.md')
>>> html = md.convert(f.read().decode('utf-8'))
>>> print(md.meta)
{'author': 'John  Doe', 'tags': ['random tag', 'other tag']}
Release History

Release History

This version
History Node

0.1.0

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting