Skip to content

fix(clipboard): preserve table cell line breaks and math - #995

Closed
Yash-Singh1 wants to merge 1 commit into
software-mansion:mainfrom
pingdotgg:fix/html-clipboard-round-trips
Closed

Yash-Singh1 wants to merge 1 commit into
software-mansion:mainfrom
pingdotgg:fix/html-clipboard-round-trips

Conversation

@Yash-Singh1

@Yash-Singh1 Yash-Singh1 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What/Why?

Copying a table loses cell line breaks in HTML and omits inline equation delimiters in Copy as Markdown.

Extend the existing HTML escapers to emit <br> for inline line separators, including CRLF as one break. Keep code-block newlines literal. Serialize inline math with $...$, matching the existing Markdown extractor. Regular Copy and the HTML math fallback keep their existing delimiter behavior.

Closes #992. This draft is for maintainer discussion under the contribution guide.

Testing

  • Two Android Robolectric tests pass against the React Native library through the upstream example's Gradle host. Both fail on the unchanged base. Table coverage includes attributed/plain cells with LF, CR, CRLF and Unicode separators.
  • Three iOS XCTest methods pass on iOS 26.5 through the upstream example app's test target. Both table regressions fail on the unchanged base; the code-block newline control passes before and after.
  • Targeted ktlint, clang-format, whitespace and commit-message checks pass.
  • The Maestro suite has not been run. The before/after screenshots below come from native iOS 26.5 and Android 15 builds of the same reusable example.

Before and after

Before is the unchanged upstream base 766fc0e; after is this PR at 3be6e76. Each platform uses the same fixture before and after. The fixture calls production native exporters with attributed table-cell data and AST nodes, writes and reads the system clipboard, then imports the HTML with the platform reader or renders the copied Markdown. These captures exercise exporters directly rather than the selection menu.

iOS

Table-cell line breaks. Before, HTML paste collapses the cell into first second. After, it preserves two lines.

Before After
iOS table-cell line breaks before iOS table-cell line breaks after

Table Markdown with inline math. Before, copied Markdown is x_1 and renders as plain text. After, it is $x_1$ and renders as math.

Before After
iOS table markdown with inline math before iOS table markdown with inline math after

Android

Table-cell line breaks. Before, HTML paste collapses the cell into first second. After, it preserves two lines.

Before After
Android table-cell line breaks before Android table-cell line breaks after

Table Markdown with inline math. Before, copied Markdown is x_1 and renders as plain text. After, it is $x_1$ and renders as math.

Before After
Android table markdown with inline math before Android table markdown with inline math after

PR Checklist

  • Code compiles and runs on iOS through the example's XCTest host
  • Code compiles and runs on Android through focused Robolectric tests
  • Updated documentation/README if applicable, no public API change
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added, focused native regressions added instead

Generated by GPT 6.1 Sol using the Codex harness.

@Yash-Singh1
Yash-Singh1 force-pushed the fix/html-clipboard-round-trips branch from 26a93f8 to 3be6e76 Compare October 15, 2026 00:16
@Yash-Singh1 Yash-Singh1 changed the title fix(clipboard): preserve table breaks and formula delimiters fix(clipboard): preserve table cell line breaks and math Oct 15, 2026
@Yash-Singh1
Yash-Singh1 marked this pull request as ready for review October 15, 2026 19:32
@hryhoriiK97

Copy link
Copy Markdown
Collaborator

Carried as #1019, which has your commit first, rebased onto current main, and one follow-up on top: the iOS HTML exporter now splits on paragraphs instead of lines so a hard break stays inside its block as <br> rather than ending the <p>, plus a few extra test cases and feature-named test files like #1015. GitHub does not allow maintainer pushes to organization-owned forks, so the branch lives upstream. We'll close this one when #1019 merges; both commits keep their authorship in the history. Thanks for the fix and the careful write-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table copying loses cell line breaks and inline math delimiters

2 participants