Skip to content

Commit

Permalink
Add handle_markdown to git workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
clemens-fricke committed Jun 28, 2023
1 parent 415d964 commit d10c5a7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- name: build docs
run: |
pip install -r ./docs/requirements.txt
python docs/source/handle_markdown.py
sphinx-build -W -b html docs/source docs/build -j auto
- name: deploy docs only if it is pushed to main
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ignore build directories
**/build/
docs/md
docs/source/_generated

# Ignore python specific file and directories
**/*.egg-info/
Expand Down
16 changes: 11 additions & 5 deletions docs/source/handle_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,17 @@ def process_file(
)
continue
elif item[1] in link_substitutions:
content = content.replace(
f"[{item[0]}]({item[1]})",
f"<a href='{link_substitutions[item[1]]}'>{item[0]}</a>",
)
continue
if relative_links:
content = content.replace(
f"[{item[0]}]({item[1]})",
f"<a href='{link_substitutions[item[1]]}'>{item[0]}</a>",
)
continue
else:
content = content.replace(
f"[{item[0]}]({item[1]})",
f"See documentation for examples.",
)
elif not relative_links: # generate links to github repo
new_path = get_github_path_from(pathlib.Path(item[1]).resolve())
else: # generate relative links
Expand Down

0 comments on commit d10c5a7

Please sign in to comment.