MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / yaml_load

Function yaml_load

tools/superfences_formaters.py:17–38  ·  view source on GitHub ↗

Custom YAML loader. Load all strings as Unicode. http://stackoverflow.com/a/2967461/3609487

(stream, loader=yaml.Loader)

Source from the content-addressed store, hash-verified

15
16
17def yaml_load(stream, loader=yaml.Loader):
18 """
19 Custom YAML loader.
20
21 Load all strings as Unicode.
22 http://stackoverflow.com/a/2967461/3609487
23 """
24
25 def construct_yaml_str(self, node):
26 """Override the default string handling function to always return Unicode objects."""
27
28 return self.construct_scalar(node)
29
30 class Loader(loader):
31 """Custom Loader."""
32
33 Loader.add_constructor(
34 'tag:yaml.org,2002:str',
35 construct_yaml_str
36 )
37
38 return yaml.load(stream, Loader)
39
40
41def get_frontmatter(text):

Callers 2

get_frontmatterFunction · 0.85
parse_optionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected