docs: use start-after/end-before for example includes#297
Conversation
Reviewer's GuideReplaces line-number-based Sphinx literalinclude directives with marker-based includes by adding start/end comment markers in example scripts and updating the docs to target those markers, making the examples more stable as code evolves. Flow diagram for marker-based Sphinx literalinclude usageflowchart LR
Docs_sources["RST docs (index.rst, examples.rst)"] --> Literalinclude["Sphinx literalinclude directive<br/>(:start-after:, :end-before:)"]
Literalinclude --> Example_scripts["Example scripts (ex_0..ex_7)<br/>with [start ...] / [end ...] markers"]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #297 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 177 177
Branches 15 15
=========================================
Hits 177 177 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
question: Can we use consistent start/end strings? Is it possible to use the same start and end strings in each example file? E.g., # [start include-in-docs-examples]
...
# [end include-in-docs-examples]Maybe that cleans things up a bit, in that the rst literalinclude looks the same in each case. Thoughts? 🤷♂️ |
|
Thanks, Jason. I tightened this up in The single-snippet example files now all use the same marker pair:
For the two files that contribute multiple snippets ( |
|
chore: Run @lavaFreak, can you see about setting up pre-commit and then running it against all files in the repo? I'll look into the CodeFactor failures on Monday. |
|
I set up the local environment from the repo docs, installed the hooks, and ran |
|
I took a look at the remaining CodeFactor failures. From what I can tell, they are pointing at the pre-existing |
|
I've filed #300 to deal with the CodeFactor findings. Maybe some setting changes behind the scene, such that these are causing a problem now vs before. |
Related Issues
What changes are proposed in this pull request?
literalincludedirectives with:start-after:/:end-before:markersHow is this PR tested?
git diff --checkSummary by Sourcery
Stabilize documentation examples by marking example code regions and updating includes to reference them instead of line numbers.
Enhancements:
Documentation: