Skip to content

Commit

Permalink
fix(i18n): bypass myst parser issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-jerry-ye committed Dec 3, 2024
1 parent 5bbd6d0 commit 87ec789
Show file tree
Hide file tree
Showing 4 changed files with 1,335 additions and 1,092 deletions.
12 changes: 12 additions & 0 deletions next/_ext/indent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://github.com/executablebooks/MyST-Parser/issues/444

# Workaround suggested in https://github.com/executablebooks/MyST-Parser/issues/444#issuecomment-1179796223
from sphinx.transforms import i18n

class ModifiedIndent:
def __init__(self, s, _):
self.s = s
def __radd__(self, _):
return f"```\n{self.s}\n```"

i18n.indent = ModifiedIndent
2 changes: 1 addition & 1 deletion next/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pathlib import Path
sys.path.append(str(Path("_ext").resolve()))

extensions = ['myst_parser', 'lexer', 'sphinx_copybutton']
extensions = ['myst_parser', 'lexer', 'indent', 'sphinx_copybutton']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', ".env", '.venv', "README", 'sources']
Expand Down
Loading

0 comments on commit 87ec789

Please sign in to comment.