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.
This commit is contained in:
ashander 2015-04-24 16:19:12 -07:00
parent dd7f3b648d
commit 305ba3eca9

View File

@ -53,9 +53,9 @@ from markdown import Extension
from markdown.preprocessors import Preprocessor
import yaml
try:
from yaml import CSafeLoader as Loader
from yaml import CBaseLoader as Loader
except ImportError:
from yaml import Loader
from yaml import BaseLoader
# Override the default string handling function to always return unicode objects