Skip to content

Commit

Permalink
[Tutorials] Consistently use LaTeX delimiter for Docusaurus
Browse files Browse the repository at this point in the history
This is a duplicate of the same code change in botorch: pytorch/botorch#2752

Docusaurus 3 requires math to be wrapped in $ delimiters. We were trying to be backwards compatible with our existing tutorials by wrapping math blocks in $ delimiters while converting to MDX but properly handling every type of math block (which this was failing to do) is beyond the scope of this script.

Since  these tutorials are intended to be consumed by Docusaurus lets just enforce the $ delimiters when writing tutorials.
  • Loading branch information
CristianLara committed Feb 21, 2025
1 parent 63a1eaf commit 3cccacf
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions scripts/convert_ipynb_to_mdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@ def sanitize_mdx(mdx: str) -> str:

# -- KaTeX --
# Wrap '\begin{}...\end{}' in $$ for KaTeX to work.
mdx = re.sub(
"(\\\\begin\\\\{(\\w*?)\\\\}(.|\n)*?end\\\\{\\2\\\\})", "$$\\g<1>$$", mdx
)
# Make sure $$ symbols are not escaped and include line breaks.
mdx = re.sub(
"\\\\?\\$\\\\?\\$((?:.|\n)*?)\\\\?\\$\\\\?\\$", "\n$$\n\\g<1>\n$$\n", mdx
Expand Down

0 comments on commit 3cccacf

Please sign in to comment.