fix(html): backtrack jsdoc summary ending with ':' to last '.'#799
Open
nanookclaw wants to merge 1 commit into
Open
fix(html): backtrack jsdoc summary ending with ':' to last '.'#799nanookclaw wants to merge 1 commit into
nanookclaw wants to merge 1 commit into
Conversation
Author
|
I have read the CLA Document and I hereby sign the CLA |
b0e8bdc to
ce7efb1
Compare
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.
Closes #633.
When rendering a title-only JSDoc summary, if the trimmed plain text ends with
:, walk back to the last.and shorten the rendered output to end there. If there's no., leave the summary as-is. The fix only touches thetitle_onlybranch increate_renderer; full-markdown rendering is unchanged.Implementation
Three private helpers added to
src/html/comrak.rs:collect_inline_plain_text— concatenates the inline subtree's plain text (Text + Code literals; SoftBreak → space). Afterwalk_node_titlethe first paragraph holds only inline nodes, so this is well-defined.shorten_inline_to— walks the inline tree in document order with a byte offset; shortens the literal that straddles the target and detaches later siblings.shorten_title_summary_trailing_colon— the policy: only act when trimmed plain text ends with:and contains a., then targetlast_dot + 1. No-op otherwise.Called between
walk_node_title(root)andrender_node(root.first_child(), ...).Tests
Six unit tests in
src/html/comrak.rs::with prior.shortens to last.:with no.left unchanged:left unchanged:after a code span backtracks past it:after emphasis backtracks past it.lives inside a code span — code span is kept up to and including., trailing text/colon droppedAll pass via
cargo test --lib html::comrak::.cargo check,cargo fmt -- --check, anddeno task tailwindclean.