fix(muya): restore inline HTML tag marker style and hide bare <br/> markers by Jocs · Pull Request #5636 · marktext/marktext · GitHub
Skip to content

fix(muya): restore inline HTML tag marker style and hide bare <br/> markers - #5636

Merged
Jocs merged 1 commit into
developfrom
fix/inline-html-tag-marker
Oct 6, 2026
Merged

Jocs merged 1 commit into
developfrom
fix/inline-html-tag-marker

Conversation

@Jocs

@Jocs Jocs commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Closes #5635
Closes #5634
Closes #1878

Summary

After the desktop renderer moved to @muyajs/core, the engine emits span.mu-html-tag for the literal inline HTML tag markers (<u>, </u>, <br/>, …) but no matching .mu-html-tag rule was carried over from the legacy engine. The markers therefore inherited the paragraph colour and font and the syntax highlighting disappeared. This restores the legacy span.ag-html-tag rule.

It also fixes the <br> marker, which was rendered unconditionally: a void tag never resolved the cursor conflict, so its literal <br/> text stayed visible in WYSIWYG mode even when the caret was elsewhere. It now collapses under .mu-hide once the caret leaves the token, and is only shown while the caret sits inside <br> — the behaviour requested in #1878.

Type of change

  • Bug fix (non-breaking, fixes an issue)
  • New feature (non-breaking, adds functionality)
  • Breaking change (causes existing functionality to change)
  • Documentation update

Test plan

  • New tests added (or explain why not needed):
    • packages/muya/src/inlineRenderer/__tests__/htmlTagMarker.spec.ts — jsdom spec: the <br/> marker collapses under .mu-hide while the real <br> stays in the flow, and is revealed again once the caret enters the token.
    • packages/muya/e2e/tests/blocks/html-inline.spec.ts — e2e assertions for the computed marker style (--editor-color-50, monospace, weight 200) and the collapsed <br/> marker.
  • Manually tested on: macOS

Commands run:

  • pnpm -C packages/muya test — 2361 passed
  • pnpm -C packages/muya lint:types / lint / lint:css — clean (only pre-existing complexity warnings)
  • e2e (chromium): blocks/html-inline plus typing/table, editing/cross-block-enter, editing/table-cell-selection, editing/table-rect-clipboard, editing/cut-into-table-5400, editing/table-last-cell-delete-5386 — all pass

Notes for reviewers [optional]

  • The <br> change keeps the rendered <br> element in the flow and collapses only the literal marker text, so the line break keeps working (verified visually).
  • The marker is still shown while the caret sits inside the <br> token, consistent with every other inline HTML tag — which is the behaviour settled on in WYSIWYG error on line breaks in raw HTML  #1878.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@Jocs
Jocs force-pushed the fix/inline-html-tag-marker branch from 44fa307 to 4d6b2b2 Compare October 6, 2026 12:39
…arkers

The @muyajs/core rewrite emitted span.mu-html-tag for the literal inline HTML
tag markers but never carried the legacy span.ag-html-tag rule over, so the
markers inherited the body colour and font and the highlighting vanished
(#5635).

The <br> renderer also wrapped its literal marker text together with the real
<br> element in an unconditional span.mu-html-tag, so the tag text stayed
visible in WYSIWYG mode even when the caret was elsewhere (#5634 / #1878).
The marker now follows the same cursor-conflict resolution as every other
inline HTML tag: it collapses under .mu-hide while the caret is outside the
token, while the <br> stays in the flow so the line break keeps working.

Restore the legacy rule and add a jsdom spec for the <br> marker plus e2e
coverage for the computed marker style and the collapsed <br/> marker.
@Jocs
Jocs force-pushed the fix/inline-html-tag-marker branch from 4d6b2b2 to 4c99550 Compare October 6, 2026 12:50
@Jocs
Jocs merged commit c054632 into develop Oct 6, 2026
7 checks passed
@Jocs
Jocs deleted the fix/inline-html-tag-marker branch October 6, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant