[Feature] Add rainbow-colored headings and different heading sizes in edit/preview modes
Is your feature request related to a problem? Please describe.
In long Markdown documents, different heading levels can be hard to distinguish quickly.
Describe the solution you'd like
Please add rainbow-colored headings in both edit mode and preview mode.
It would also be helpful if heading levels in edit mode used different font sizes (both edit mode and preview mode), so the hierarchy is easier to recognize while writing.
A possible color reference:
- H1: orange
#E36C0A - H2: amber / yellow
#D99A00 - H3: olive green
#9AA11A - H4: soft green
#6FB07A - H5: teal
#4FA3A5 - H6: pink / purple
#C16A92
Describe alternatives you've considered
Using only bold text or Markdown syntax helps, but color and font-size differences would make heading levels much easier to scan.
Additional context
This would improve readability for notes, documentation, and long Markdown files with many heading levels.
Just another user here, I like it but personally I would prefer if was just an togglable option, as in most instance I would not want a rainbow, especially in preview mode that I sometime convert to pdf to share with others.
Bonus: each levels colours would be customisable with a colour pallet, with a few basic colour themes.
I would have 2 toggle: one for edit mode: as toggle heading colours after the heading section. for the colours selection could be a small corner arrow at the bottom right of each heading button to give you the panelm and for the them that would be on the toggle button to have a small arrow at the bottom right (or put everything at the toggle area for a clearner look). otherwise move the colour customisation to settings
and another: top right for the preview section to toggle into the preview mode, with the customisation in settings
I looked into what this would take. Two findings worth putting in front of a decision, both about collisions with things Markpad already does.
1. Heading colour in the editor is already owned by the imported theme.
Headings in edit mode aren't unstyled: the semantic layer paints heading as accent + bold and heading.marker as accent (src/lib/utils/editorTheme.ts). And when a VS Code theme is imported, its markup.heading / entity.name.section scope is mapped through MARKDOWN_SCOPE_ALIASES and rewrites that colour (importedThemeRules in src/lib/utils/theme.ts).
So per-level colours force a choice that can't be dodged:
- rainbow wins — an imported theme's heading colour silently stops applying;
- theme wins — the rainbow only shows for themes that don't define
markup.heading, which is most of the time not the case.
Neither is obviously right, and it decides most of the diff.
2. It runs against the colouring principle the code states.
editorTheme.ts explains why #, list bullets, >, table pipes and horizontal rules all share one colour:
Distinguishing kinds of markup matters less than distinguishing markup from prose
Per-level heading colours are the opposite of that. That rule can of course be changed, but it seems worth changing deliberately rather than as a side effect.
Smaller notes
- The proposed palette is tuned for a light background —
#9AA11Aand#D99A00on#1e1e1eneed a second set. That is 6 colours x 2 appearances added to aPALETTEthat currently holds 6 semantic roles (text / muted / accent / code / emphasis / link); heading level isn't a semantic role, so it changes what that table is. - Preview font sizes for h1-h6 already exist in
styles.css. Only edit mode is uniform, so the "different font sizes" half of this request is really an edit-mode-only request. - Editor font sizes per level are technically possible (Monaco decorations carry
fontSize/lineHeight), but they are a different mechanism from colour — colour flows through the theme layer, size cannot. So this issue is two features with different blast radii, and they'd be better split. - @Guardiancelte's PDF point is real:
export.tsandexportHtml.tscarry their own CSS and would each need a separate decision.
On the underlying problem — in edit mode the level is already encoded twice, by the length of the # run and by where the title text starts, and the pinned outline panel covers scanning structure in a long document. The case is strongest for h4-h6, which are also the levels that appear least often.
Happy to implement whichever direction the maintainer prefers, but the theme-vs-rainbow question above needs settling first.