From 844c54901445dfbe05e442393a7cfbfd7b9e07e7 Mon Sep 17 00:00:00 2001 From: Takayuki SHIMIZUKAWA Date: Fri, 13 Sep 2024 15:42:51 +0000 Subject: [PATCH] Fix: double escape problem of MyST-Parser --- .gitignore | 1 + source/_ext/myst_patch.py | 12 ++++++++++++ source/conf.py | 5 +++-- source/policies/internet-policy.md | 3 +-- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 source/_ext/myst_patch.py diff --git a/.gitignore b/.gitignore index 1963a85..5288178 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ env/ .vscode/ +**/__pycache__/ diff --git a/source/_ext/myst_patch.py b/source/_ext/myst_patch.py new file mode 100644 index 0000000..411269e --- /dev/null +++ b/source/_ext/myst_patch.py @@ -0,0 +1,12 @@ +from myst_parser.mdit_to_docutils import base + +def setup(app): + # refs: https://github.com/executablebooks/MyST-Parser/issues/760 + base.escapeHtml = lambda s: s + + return { + 'version': '0.1', + 'env_version': 1, + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } diff --git a/source/conf.py b/source/conf.py index 7140ac2..6dac56d 100644 --- a/source/conf.py +++ b/source/conf.py @@ -10,9 +10,9 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os +import os import sys -# sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('_ext')) # -- Project information ----------------------------------------------------- @@ -28,6 +28,7 @@ # ones. extensions = [ "myst_parser", + "myst_patch", 'sphinxext.opengraph', ] diff --git a/source/policies/internet-policy.md b/source/policies/internet-policy.md index 8c5f34a..565f334 100644 --- a/source/policies/internet-policy.md +++ b/source/policies/internet-policy.md @@ -1,5 +1,4 @@ -[English translation of Internet connection service provision policy](https://bit.ly/3TsvXCx) - +[English translation of Internet connection service provision policy](https://www-pycon-jp.translate.goog/policies/internet-policy.html?_x_tr_sl=ja&_x_tr_tl=en&_x_tr_hl=ja&_x_tr_pto=wapp) # インターネット接続サービス提供ポリシー