Skip to content

Commit

Permalink
more progress
Browse files Browse the repository at this point in the history
  • Loading branch information
epinzur committed Oct 6, 2023
1 parent 87221a0 commit b89e66d
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 198 deletions.
26 changes: 0 additions & 26 deletions python/docs/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@
from plum import dispatch


# utils -----------------------------------------------------------------------


def escape(val: str):
return f"`{val}`"


def sanitize(val: str, allow_markdown=False):
# sanitize common tokens that break tables
res = val.replace("\n", " ").replace("|", "\\|")

# sanitize elements that can get interpreted as markdown links
# or citations
if not allow_markdown:
return res.replace("[", "\\[").replace("]", "\\]")

return res


def convert_rst_link_to_md(rst):
expr = (
r"((:external(\+[a-zA-Z\._]+))?(:[a-zA-Z\._]+)?:[a-zA-Z\._]+:`~?[a-zA-Z\._]+`)"
)

return re.sub(expr, r"[](\1)", rst, flags=re.MULTILINE)


# render -----------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions python/docs/_quartodoc.old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ quartodoc:
style: _renderer.py
options:
children: separate
include_empty: true
dynamic: true
render_interlinks: true

Expand Down
Loading

0 comments on commit b89e66d

Please sign in to comment.