Skip to content

fix(editor): preserve literal Markdown text across saves and edits - #92

Merged
mameen merged 6 commits into
AlienTechSoftware:mainfrom
angel1411337-del:fix/markdown-literal-text
Nov 12, 2026
Merged

mameen merged 6 commits into
AlienTechSoftware:mainfrom
angel1411337-del:fix/markdown-literal-text

Conversation

@angel1411337-del

Copy link
Copy Markdown
Contributor

What and why

Literal span text can turn into Markdown formatting, or lose its backslashes, when a page is saved and reopened. Escaping that text for storage also exposed the storage backslashes in the editor and broke cursor and selection mapping when returning to a line.

This change separates storage quoting from editable text. It preserves literal and inline-image identity through widget edits and structural operations, and handles escaped delimiters and table cells in the parser. Clear Formatting and Copy/Cut use semantic selections, including table cells and selections that cross paragraphs.

It has no voice code, feature flag, dependency, lockfile or workflow changes. Inline code that contains embedded backticks is still an independent parser limitation. Reproduction and manual acceptance steps are in docs/testing-literal-text.md.

Quality level L3 (see SKILLS/nc-devx/SKILL.md)

  • The branch is rebased on main (4286f7b) and has no merge commits: one commit
  • cargo xtask ci passes locally on Rust 1.97 (see below); the pinned 1.99.1 run is this pull request's CI
  • Coverage: the coverage job's warnings are read; cargo xtask coverage --update is in
    this pull request if coverage rose (to read once CI has run)
  • Docs match the change: docs/testing.md and the new docs/testing-literal-text.md; no command, MCP or control-protocol change
  • A new user action is a CommandSpec with a test: no new user action
  • Page or demo changes: cargo xtask demo-check and the format parity test pass; every demo page round-trips in both formats
  • UI changes: none beyond the editing line no longer showing storage backslashes
  • New files under assets/ or docs/images/: none

How it was checked

On the current main (4286f7b), with Rust 1.97.0 locally (this environment could not download the pinned 1.99.1; GitHub CI runs it):

  • cargo xtask ci passed: fmt, clippy, tests (988 passed, 0 failed, 2 existing manual large-fixture tests ignored), i18n-audit, layers, assets, docs, text, demo-check.
  • cargo build --workspace --locked passed.
  • Rebasing onto current main needed one small change: two tests added upstream (in fix(ui-egui): draw a box wide enough to hold its table #75) build pageedit::Caret literals, and they now set the new inline: None field.
  • New regression tests reproduce the failures before the fix. They cover re-entry, replacement ranges, Unicode and font mapping, images, split and join, tags, tables, Clear Formatting and Copy/Cut, plus repeated save/reopen cycles in crates/formats/tests/literal_text.rs and structure_on_save.rs.
  • Earlier, on a71a3c6 with Rust 1.99.1: comparing upstream and this change across the demo corpus gave 840 model, layout and canonical outputs with zero differences.

Not checked: a side-by-side visual look at both demo formats. The parsed blocks are identical, so rendering should not change.

Written with AI assistance (Codex and Claude), reviewed and tested as above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KowAZudvkUiQS623fiB331

@angel1411337-del
angel1411337-del marked this pull request as ready for review November 11, 2026 15:13
Merging main brought in a test from AlienTechSoftware#89 that builds a full
pageedit::Caret literal. This branch adds the `inline` field to Caret,
so the test no longer compiled; it now sets `inline: None`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KowAZudvkUiQS623fiB331
@mameen
mameen merged commit 9408883 into AlienTechSoftware:main Nov 12, 2026
9 checks passed
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.

2 participants