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:
parent
dd7f3b648d
commit
305ba3eca9
@ -53,9 +53,9 @@ from markdown import Extension
|
|||||||
from markdown.preprocessors import Preprocessor
|
from markdown.preprocessors import Preprocessor
|
||||||
import yaml
|
import yaml
|
||||||
try:
|
try:
|
||||||
from yaml import CSafeLoader as Loader
|
from yaml import CBaseLoader as Loader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader
|
from yaml import BaseLoader
|
||||||
|
|
||||||
|
|
||||||
# Override the default string handling function to always return unicode objects
|
# Override the default string handling function to always return unicode objects
|
||||||
|
Loading…
Reference in New Issue
Block a user