Go to file
ashander 305ba3eca9 Use BaseLoader to avoid type mapping
In PyYAML tag types are mapped to python types (http://pyyaml.org/wiki/PyYAMLDocumentation#YAMLtagsandPythontypes)

In contrast, in Markdown Meta-Data extension, values are strings (https://pythonhosted.org/Markdown/extensions/meta_data.html).

The BaseLoader class only construct basic Python objects: lists, dictionaries and Unicode strings so will likely perform more as expected.
2015-04-24 16:19:12 -07:00
__init__.py Add __init__.py so extension is usable as module 2014-11-30 21:57:52 +01:00
.gitignore Add gitignore 2014-12-24 23:57:23 -05:00
LICENSE.md Initial checkin 2014-07-20 11:15:27 +02:00
meta_yaml.py Use BaseLoader to avoid type mapping 2015-04-24 16:19:12 -07:00
README.md Move copyright up 2014-07-20 11:29:11 +02:00

YAML Meta Data Extension for Python-Markdown

This extension adds YAML meta data handling to markdown.

As in the original, meta data is parsed but not used in processing.

(YAML meta data is used e.g. by pandoc)

Dependencies: PyYAML

Copyright 2014 Bernhard Fisseni

Based on the meta data extension included with Python-Markdown, Copyright 2007-2008 Waylan Limberg.

License: BSD (see LICENSE.md for details)

Basic Usage

>>> import markdown
>>> text = '''---
... Title: Test Doc.
... Author: Waylan Limberg
... Blank_Data:
... ...
...
... The body. This is paragraph one.
... '''
>>> md = markdown.Markdown(['meta_yaml'])
>>> print(md.convert(text))
<p>The body. This is paragraph one.</p>
>>> print(md.Meta) # doctest: +SKIP
{'blank_data': [''], 'author': ['Waylan Limberg'], 'title': ['Test Doc.']}

Use in Sublime Text 3 with OmniMarkupPreviewer

  • copy python code e.g. to Packages/User

  • enable as extension in User Preferences

      "extensions": [
          ...
          "User.meta_yaml", // if installed in Packages/User
          ...
      ]