Skip to content

fix(notes): render numeric comparisons without changing source - #3215

Open
binaricat wants to merge 2 commits into
mainfrom
codex/fix-3205-notes-comparison-markdown
Open

fix(notes): render numeric comparisons without changing source#3215
binaricat wants to merge 2 commits into
mainfrom
codex/fix-3205-notes-comparison-markdown

Conversation

@binaricat

Copy link
Copy Markdown
Owner

Summary

Notes containing ordinary numeric comparisons such as 内存<1GB设备 cannot be read or edited as formatted Markdown. The JSX tokenizer mistakes <1 for the start of a tag and rejects the entire document. This was reproduced with the author's complete note and the minimal comparison, before making changes.

On v1.1.82 the failed import looks blank. Current main already includes #3175's source fallback, so it shows raw source instead; that safeguard does not fix formatted reading. This PR makes numeric comparisons render normally while keeping that fallback for unsupported input.

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • Build / CI change
  • Other (please describe):

Related Issue (optional)

Related to #3205. Leave the issue open; this PR is not authorized for merge.

Changes Made

  • Apply a version-pinned patch-package patch to both development and production exports of micromark-extension-mdx-jsx. When < is followed by a digit, =, +, -, or ., let the normal Markdown parser keep the text instead of throwing a JSX error. The source is not preprocessed, and HTML handling stays enabled.
  • Ignore the rich editor's initial normalization callback and read-only export callbacks so merely opening a note or switching modes does not rewrite its source. Actual first edits still save, and preview task-checkbox actions keep their existing explicit save path.
  • Add the author's original note as an inert fixture and six regression tests covering comparisons, HTML image/link attributes, inline/fenced code, exact source preservation, first-edit persistence, preview checkboxes, and note-switch/fallback isolation. Extend the JSDOM browser shims for the real code/image editors.

Scope: numeric comparisons only. Unclosed tag-like text such as <host> still uses #3175's editable/read-only source fallback. This does not attempt general MDX/CommonMark compatibility. Rich-text edits retain the editor's existing Markdown serialization (e.g. escaping a literal <); viewing alone preserves the original bytes. The fixture intentionally keeps its author's two-space Markdown line break.

Screenshots / Demo

Manually exercised the real InlineMarkdownEditor in a local Vite page and in a separately built production version of that page:

  • Author's full note: source → preview → edit → source; heading, comparison table cell, all ten code blocks and ending content render, with zero source changes.
  • Minimal comparison: preview → first actual edit → source → preview; changed text saves and reopens correctly.
  • Adjacent numeric forms, inline/fenced code, loaded HTML image with preserved attributes, HTML link, preview task-checkbox click, unsupported-note fallback, and switching back to the author note.
  • Fresh development and production page sessions reported no console warnings/errors.

Browser checks were on macOS using the actual Notes component, not a packaged Windows application. No commands from the note were executed.

Testing

  • I have tested these changes locally (Vite development and production browser pages described above)
  • Linting passes (npm run lint)
  • Tests pass (npm test): 10,966 passed, 12 skipped, zero failures using Node 24 after restoring Electron 42.3.3
  • Generated capability tool specs are updated when applicable (npm run generate:capability-tools) — not applicable
  • No new console errors or warnings, if this affects app behavior

Additional checks:

  • The minimal real-editor regression failed before the fix with “a comparison must render as ordinary text”; it passes afterward.
  • All 14 Notes import/fallback tests pass, including with node --conditions development --test --import tsx components/notes/InlineMarkdownEditor.unrenderableMarkdown.test.tsx.
  • A fresh complete npm ci successfully applied the committed dependency patch automatically.
  • npm run build passed, followed by actual interaction with a production-built component page.
  • The first full-suite attempt under local Node 26 could not find the Electron runtime. Restoring the runtime and rerunning the entire suite under Node 24 produced the passing result above; no product changes were made for that environment issue.

Checklist

  • My code follows the existing project style
  • I have added or updated relevant documentation (patch rationale and scope are documented inline and above)
  • I have not introduced any breaking changes (or I have described them above)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T15:05:37.486062Z 46aa537 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@binaricat binaricat added the automation:codex-loop Own/bot PR waiting on Codex review↔fix loop label Aug 30, 2026
@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@binaricat
binaricat marked this pull request as draft August 30, 2026 14:46
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 611f9cca3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review August 30, 2026 14:50
@netcatty-bot netcatty-bot added automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Aug 30, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator

Codex reported no major issues. This PR is marked ready for human review/merge.

@binaricat binaricat added automation:codex-loop Own/bot PR waiting on Codex review↔fix loop and removed automation:codex-clean Last Codex review reported clean labels Aug 30, 2026
@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@binaricat
binaricat marked this pull request as draft August 30, 2026 15:02
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 46aa537c0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@netcatty-bot
netcatty-bot marked this pull request as ready for review August 30, 2026 15:06
@netcatty-bot netcatty-bot added automation:codex-clean Last Codex review reported clean and removed automation:codex-loop Own/bot PR waiting on Codex review↔fix loop labels Aug 30, 2026
@netcatty-bot

Copy link
Copy Markdown
Collaborator

Codex reported no major issues. This PR is marked ready for human review/merge.

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

Labels

automation:bot-pr PR created or owned by Cursor automation automation:codex-clean Last Codex review reported clean

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants