docs: make docs mdxv2 compatible (#26798)

prep for docusaurus migration
This commit is contained in:
Erick Friis
2024-09-23 21:24:23 -07:00
committed by GitHub
parent 2a4c5713cd
commit 603d38f06d
34 changed files with 107 additions and 94 deletions

View File

@@ -31,6 +31,20 @@ class EscapePreprocessor(Preprocessor):
r"[\1](\2.md)",
cell.source,
)
elif cell.cell_type == "code":
# escape ``` in code
cell.source = cell.source.replace("```", r"\`\`\`")
# escape ``` in output
if "outputs" in cell:
for output in cell["outputs"]:
if "text" in output:
output["text"] = output["text"].replace("```", r"\`\`\`")
if "data" in output:
for key, value in output["data"].items():
if isinstance(value, str):
output["data"][key] = value.replace("```", r"\`\`\`")
return cell, resources