Repository navigation
Conversation
escape_content had no case for backslash, so it escaped the backslash of an escape sequence that was already in the source: `\]` became `\\]`, a literal backslash followed by a bare `]` that closes the caller's content block early. Copy escape sequences through whole instead.
Tokenizing `\]` as two tokens lets the diff cut between them. The backslash
is then left at the end of the unchanged text, where it escapes the `#` of
the call written next to it, so "\[x\] [grp]" against "\[x\]" renders as
\[x\#diff-deleted[\] \[grp]]
and Typst prints the call itself to the page instead of striking the deleted
words through. The character the backslash guarded is loose markup on the
other side of the cut.
Treat an escape sequence as one atomic token, like `#func[...]` and `@ref`.
Raw text is literal, so a diff call written between the backticks is printed
to the page as characters instead of being run:
`#diff-deleted[ttIdx]#diff-added[tpIdx]`
Treat a raw element as one atomic token, like `#func[...]` and `@ref`, so the
diff wraps it whole rather than reaching inside it, and copy raw through
escaping untouched: inside backticks a `]` does not close the caller's content
block and a backslash is not an escape, so escaping there is both needless and
puts stray characters on the page.
The cost is that a changed raw span is now replaced whole rather than diffed
word by word, since any finer granularity means writing a diff call between
the backticks.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
When diffing documents I found some areas that need improvements, mostly around splitting (or not splitting) text chunks.
I'm doing the changes as individual PRs to make reviewing easier, but this PR already gives an overview of what's coming.