fix: add guardrail test for unescaped markdown in command descriptions#549
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #549 +/- ##
=======================================
Coverage 71.64% 71.64%
=======================================
Files 225 225
Lines 19074 19074
=======================================
Hits 13665 13665
Misses 4202 4202
Partials 1207 1207 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The docgen command parses Long descriptions as Go text/template and
renders them as MDX for the docs site. Unescaped { characters break
the Docusaurus build. This adds a test that walks all commands and
validates their descriptions render correctly, catching issues in CI
rather than at release time.
e5ef5b5 to
4c8e9c9
Compare
Member
Author
|
@zimeg Thanks for the quick review! 🙌🏻 Feel free to follow-up for deeper checks. We could add it for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Summary
This pull request adds a guardrail to prevent unescaped markdown characters from breaking the documentation website build.
After #547 revealed that unescaped
{and[in command descriptions can break the Docusaurus MDX build, this adds:Longdescriptions render correctly through the sametext/templatelogic used bydocgenCLAUDE.mdguidance so contributors know to escape{and[in descriptionsPreview
Testing
cmd/api/api.goto remove the escaped\\{to be{in theLongdescription.make test.--- FAIL: Test_CommandDescriptionsRenderForDocs (0.01s) --- FAIL: Test_CommandDescriptionsRenderForDocs/cmd.test_api (0.00s) make: *** [test] Error 1Notes
cmd/root_test.gobecause the test needsInit()to build the full command tree - putting it incmd/docgen/would create a circular importRequirements