Skip to content

Commit 228535a

Browse files
authored
Remove YAML unicode tags from Mkdocs config (#2998)
In the case of a unicode string without a unicode character, YAML adds a tag to ensure the text is read as unicode, ie: In [1]: import yaml In [2]: yaml.dump(u'surprise!') Out[2]: "!!python/unicode 'surprise!'\n" This forces only literals are output to the YAML config, by using `safe_dump` instead of `dump`
1 parent 91a72f5 commit 228535a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readthedocs/doc_builder/backends/mkdocs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def append_conf(self, **__):
100100
if 'theme_dir' not in user_config and self.use_theme:
101101
user_config['theme_dir'] = TEMPLATE_DIR
102102

103-
yaml.dump(
103+
yaml.safe_dump(
104104
user_config,
105105
open(os.path.join(self.root_path, 'mkdocs.yml'), 'w')
106106
)
@@ -187,7 +187,7 @@ def build(self):
187187
)
188188
if user_config['theme_dir'] == TEMPLATE_DIR:
189189
del user_config['theme_dir']
190-
yaml.dump(
190+
yaml.safe_dump(
191191
user_config,
192192
open(os.path.join(self.root_path, 'mkdocs.yml'), 'w')
193193
)

0 commit comments

Comments
 (0)