Skip to content

Keep inline HTML formatting in Docs and make inline HTML editable - #5444

Closed
brsbl wants to merge 8 commits into
bb/docs-raw-html-2-blocksfrom
bb/docs-raw-html-3-inline
Closed

brsbl wants to merge 8 commits into
bb/docs-raw-html-2-blocksfrom
bb/docs-raw-html-3-inline

Conversation

@brsbl

@brsbl brsbl commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

After #5443, inline HTML is still a locked chip showing its literal tags. <strong> and <kbd> lose their formatting and <br> in a table cell shows as text. When a table is saved as HTML, inline HTML inside it is written as editor placeholder markup instead of its source.

What changed

  • Inline formatting tags like <strong>, <kbd>, <sub>, and <a> display as formatting and keep their exact source.
  • Other inline tags, such as <video>, become editable inline source; <br> stays a line break.
  • Tables saved as HTML keep their inline HTML's original source.
  • Internal markers carry a per-page random value, so marker-like text in files or pastes stays plain text.
  • Inline HTML source is code to the editor: links, bold, and autolinks stay off it, and pastes into it insert plain text.
  • Tags that wrap links or code, sit directly inside emphasis, or would merge with an identical tag stay as editable source.
  • Pasted HTML never becomes raw HTML, even with this page's marker or a crafted paste context.
  • One RawHtml extension registers the set. Tag pairing runs in linear time per paragraph.
  • Stacked on Never strip HTML when saving Docs #5443. No Plugin SDK, CLI, or wire changes; the Docs README is updated.

How you verified

  • Remote CI passed on 2f7047311.
  • Tests cover inline formatting round trips, tags around emphasis, links, code, and identical tags, links, bold, paste, and autolink inside source, forged pastes, task lists, HTML-saved tables, and linear-time pairing.
  • Per-layer Slop Cop review of 296f0c082 found four blocking issues; 2f7047311 fixes them with regression tests.
  • Browser QA of 296f0c082 passed all seven steps with no console errors.

Screenshots · inline HTML

Before: fac9bea04 · After: 296f0c082 · Captured at 2×

Screen / state Viewport Before After
Doc with HTML embeds / opened Desktop · 1440×900 Before: inline tags shown as literal text After: kbd, strong, and br render as formatting
Doc with HTML embeds / opened Mobile · 390×844 Before on mobile: inline tags shown as literal text After on mobile: kbd, strong, and br render as formatting
Known limitations
  • Tags that wrap links or code, or start right inside emphasis, show as editable source instead of formatting.
  • Runs of whitespace inside inline HTML, including HTML that starts a list item, collapse to one space on save.
  • Formatting tag attributes, such as an href, are edited in the file rather than in the editor.

BB-Thread-ID: thr_fashr87x6y

🤖 Generated with Claude Code

AGENT GENERATED

@brsbl
brsbl added this pull request to stack #5445 October 13, 2026 18:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-10-13T18:43:39.698883Z feceb9d PR opened
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: feceb9dd7d

ℹ️ 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".

Comment thread plugins/docs/raw-html.ts
Comment on lines +206 to +207
const closing = /^<\/([a-z]+)>$/.exec(token.content)?.[1];
if (!closing || !counts.get(key(closing, level))) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize closing tag names before pairing

For valid uppercase or mixed-case HTML such as <STRONG>bold</STRONG>, phrasingTag normalizes the opening name to strong, while this expression captures the closing name as STRONG. The count lookup therefore fails and both tags are displayed as editable source instead of rendering the promised inline formatting. Normalize the captured closing name before using it as a pairing key.

Useful? React with 👍 / 👎.

@brsbl
brsbl force-pushed the bb/docs-raw-html-3-inline branch from feceb9d to d44abac Compare October 13, 2026 18:47
@brsbl
brsbl force-pushed the bb/docs-raw-html-3-inline branch from d44abac to 296f0c0 Compare October 13, 2026 19:01
brsbl and others added 7 commits October 13, 2026 19:26
Task list checkboxes pass through instead of becoming raw HTML, so
checked items stay checked. Multi-line HTML inside blockquotes and lists
keeps its prefixes, HTML that starts a list item stays in the list, and
an ::html directive followed by text stays a directive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HTML blocks the editor can save as Markdown and reload unchanged display
as normal content, and tables Docs saves as HTML stay editable. Other
HTML blocks become editable source blocks that are saved exactly as
typed, including inside blockquotes and lists. An ::html directive
followed by text stays a directive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lists

The lossless check now applies the editor's own load-time newline
handling, so HTML whose words would be joined on save stays as source.
It ignores only the exact column widths Tiptap writes and keeps tfoot,
so footer rows and custom widths are not rewritten. HTML that starts a
list item stays inside the item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A block is displayed as normal content only when it closes every element
it opens, and the editor inserts the HTML that was checked rather than
the raw source, so an unfinished tag can no longer swallow the rest of
the document. The README says such blocks are saved in equivalent form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inline formatting tags such as <strong>, <kbd>, and <sub> display as
formatting and keep their exact source. Other inline tags become editable
inline source, and <br> stays a line break. Tag pairing runs in linear
time, internal markers carry a per-page random value so marker-like text
in files or pastes stays plain text, and tables saved as HTML keep their
inline HTML's original source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inline HTML source is code to the editor: links, bold, and autolinks are
kept off it and pastes into it insert plain text. Tags that wrap links or
code, sit directly inside emphasis, or would merge with an identical tag
stay as editable source instead of formatting. Task list checkboxes pass
through, HTML that starts a list item stays in the list, and pasted HTML
never becomes raw HTML. One RawHtml extension registers the set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brsbl
brsbl force-pushed the bb/docs-raw-html-3-inline branch from 296f0c0 to 99a1f11 Compare October 13, 2026 19:31
@brsbl brsbl closed this Oct 14, 2026
@brsbl
brsbl deleted the bb/docs-raw-html-3-inline branch October 14, 2026 17:45
An error occurred while trying to automatically change base from bb/docs-raw-html-2-blocks to main October 14, 2026 18:05
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.

1 participant