Skip to content

Only apply markdown decorations when the note has markdown enabled#3408

Open
gunjanjaswal wants to merge 3 commits into
Automattic:trunkfrom
gunjanjaswal:fix/3379-markdown-decorations-gate
Open

Only apply markdown decorations when the note has markdown enabled#3408
gunjanjaswal wants to merge 3 commits into
Automattic:trunkfrom
gunjanjaswal:fix/3379-markdown-decorations-gate

Conversation

@gunjanjaswal

Copy link
Copy Markdown

Fixes #3379.

Markdown decorations (headings, bold, italic, list markers, and so on) were applied in the editor even when the note had Markdown disabled. Every other Markdown behavior in note-content-editor.tsx gates on the note's markdown system tag, but the decoration path in setDecorators did not, so a plain note with a line like # comment or *.conf still got heading/emphasis styling. This is the v2.26.0 regression reported in #3379.

Changes proposed

  • markdown-decorations.ts: getMarkdownDecorations now takes a markdownEnabled flag (defaults to true) and returns [] when it is false.
  • note-content-editor.tsx: pass note.systemTags.includes('markdown'). The existing clear() stays unconditional, so decorations are removed when Markdown is toggled off on an open note.
  • markdown-decorations.test.ts: add a case asserting no decorations are returned when markdown is disabled.

Testing instructions

npx jest lib/markdown-decorations.test.ts

Or manually: open a note with Markdown disabled and a body containing # heading or **bold**, confirm the text stays plain, then toggle Markdown on and confirm the styling appears.

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.

Markdown formatting applied even when markdown disabled

1 participant