Repository navigation
fix(clipboard): preserve table cell line breaks and math - #1019
Merged
Merged
Conversation
collectParagraphsData split on lineRangeForRange:, which treats the U+2028 a hard break renders as like a paragraph end. A paragraph with a hard break exported as two <p> blocks and a list item as two <li> items, and with the new <br> escaping the first half gained a trailing <br>. Split on paragraphRangeForRange: so the break stays in its block and becomes <p>line one<br>line two</p>. Tests are named by feature like #1015: ClipboardExportTests.mm and ClipboardExportTest.kt, since both cover HTML and Markdown export. Added a rendered hard-break case on iOS, the code block gate on Android, a run that mixes escaped characters with a line break, and math nested in strong, on both platforms. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 of 6 tasks
eszlamczyk
approved these changes
Oct 16, 2026
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.
What/Why?
Copying a table loses two things: HTML export writes cell line separators through as whitespace, which receiving apps collapse, and Copy as Markdown drops the
$…$around inline equations. The HTML escapers now emit<br>for line separators outside code blocks, with CRLF as one break, and both markdown serializers emitLatexMathInlinewith its delimiters.This carries @Yash-Singh1's #995 (3be6e76, here 8d688af) unchanged as the first commit, rebased onto current
main, plus one follow-up. #995 comes from an organization-owned fork, which GitHub does not let maintainers push to, so the follow-up lands here. #995 stays open for the discussion there and closes when this merges; both commits keep their authorship.Closes #992.
Follow-up commit on top of #995
collectParagraphsDatasplit blocks withlineRangeForRange:, which treats the U+2028 a hard break renders as like a paragraph end. A paragraph with a hard break already exported as two<p>blocks and a list item as two<li>items, and with the new<br>escaping the first half gained a trailing<br>. It now splits withparagraphRangeForRange:, so the break stays inside its block and comes out as<p>line one<br>line two</p>. Android renders hard breaks as\n, which its splitter also treats as a block end, so this PR does not change Android's hard-break export; that needs a marker on the break and is separate work.ClipboardExportTests.mmandClipboardExportTest.kt, since both cover HTML and Markdown export. Added on top of the PR's cases: a rendered hard-break paragraph and list item on iOS, the code block gate on Android, a run mixing escaped characters with a line break, and math nested in strong, on both platforms. The Android style map gained the spoiler, superscript and subscript entries the renderer resolves eagerly.Notes
<br>stays literal with HTML spans disabled and a backslash break ends the row. Once fix(parser): preserve named and numeric character references #1018 merges,| a b |decodes to a real newline in the cell and this PR's escaper is what turns it into<br>, so the separator cases are the right coverage for that. A rendered end-to-end case through the parser is worth adding after fix(parser): preserve named and numeric character references #1018.Spoileris missing from both markdown serializers in the same way math was, so||x||in a cell also loses its delimiters on Copy as Markdown. Left for a separate change.Testing
ClipboardExportTestthrough the example's Gradle host: 4 tests green.PR Checklist
🤖 Generated with Claude Code