📚🩹 Fix rendering of Result with nbsphinx (workaround)#1244
📚🩹 Fix rendering of Result with nbsphinx (workaround)#1244s-weigand merged 3 commits intoglotaran:mainfrom
Conversation
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.15%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
|
Benchmark is done. Checkout the benchmark result page. Benchmark diff v0.6.0 vs. mainParametrized benchmark signatures: BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)Benchmark diff main vs. PRParametrized benchmark signatures: BenchmarkOptimize.time_optimize(index_dependent, grouped, weight) |
Codecov ReportBase: 88.1% // Head: 88.1% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #1244 +/- ##
=====================================
Coverage 88.1% 88.1%
=====================================
Files 104 104
Lines 5064 5064
Branches 842 842
=====================================
Hits 4462 4462
Misses 484 484
Partials 118 118
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
7ea3cf4 to
d8608de
Compare
8692e0d to
a3fd145
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
jsnel
left a comment
There was a problem hiding this comment.
What can I say? It's a workaround. We'll stay on the lookout for alternatives.








This is just a hack for the docs to render properly with the markdown repr of
Result.See current docs on main (will be different in the future when looking back at this PR) and the build for this PR (might be deleted)
Down the rabbit hole
The problem is the markdown repr of the Result and our notebook docs plugin (nbsphinx) using pandoc to transform markdown to reST as the intermediate format that sphinx can then picked up by sphinx (doc building framework) to create html, latex ...
The markdown repr of Result looks something like this
Which is totally valid markdown since that is a superset of html
When we build the docs this string gets extracted by nbsphinx which then uses pandoc to transform it into reST which looks like this
So far so good, but when sphinx takes over to generate html the problem starts since it assumes that
</details>is part of the sectionThis breaks the opening and closing order in such a way that the browser moves out the last cells from the main context wrapper into the document root which is why it look so messed up
The very dirty workaround is to wrap
</details>into two empty section tags first closing the two parent section and than opening two new ones that get closed by the existing closing tagsSo the new markdown would be
The markdown repr of Result looks something like this
Which then gives us the following reST
Which then finally gets transformed in none broken HTML
The markdown renders fine in vscode and jupyter lab but it is a bloody mess, just to compensate the wrong assumption on sphinx 🤷♀️
But I looked into all the steps of the translation process and there seems to be no quick and easy way around it.
Change summary
Checklist