Skip to content

Commit

Permalink
📚🩹 Fix rendering of Result with nbsphinx (workaround) (#1244)
Browse files Browse the repository at this point in the history
* 📚🩹 Fix rendering of Result with nbsphinx (workaround)

* 🤔 Use conda build env on RTD to control pandoc version

* 🩹 Fix wrong number of sections closed in hack
  • Loading branch information
s-weigand authored Feb 18, 2023
1 parent e95baf6 commit f435b0e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
11 changes: 11 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: RTD-env
channels:
- conda-forge
dependencies:
# Python interpreter
- python=3.10
- pandoc>=2.19.2
- pip
- pip:
- -r requirements.txt
- ..
10 changes: 9 additions & 1 deletion glotaran/project/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,15 @@ def markdown(
if wrap_model_in_details is False:
result_table = f"{result_table}\n\n{model_md}"
else:
result_table = f"{result_table}\n\n<br><details>\n\n{model_md}\n</details>"
# The section part is just a hack to generate properly rendering docs due to a bug
# in sphinx which causes a wrong tag opening and closing order of html tags
# Since model_md contains 2 heading levels we need to close 2 sections
result_table = (
f"{result_table}\n\n<br><details>\n\n{model_md}\n"
f"{'</section>'*(2)}"
"</details>"
f"{'<section>'*(2)}"
)

return MarkdownStr(result_table)

Expand Down
9 changes: 3 additions & 6 deletions readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ sphinx:
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "mambaforge-4.10"

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
conda:
environment: docs/environment.yml

0 comments on commit f435b0e

Please sign in to comment.