Use case
I'm building a two-pane Markdown app for macOS — raw source on the left, rendered preview on the right, the classic Typora split. The preview pane is isEditable: false and looks great out of the box. The source pane is where I got stuck.
What I hit
rawSourceMode shows the source, but with no colouring at all — not the Markdown syntax, and not fenced code blocks either, because restyleTextView returns before the styling pass ever runs:
// NativeTextViewCoordinator+Restyling.swift:206
guard !configuration.rawSourceMode else { return }
So MarkdownEngineCodeBlocks has no effect in that mode. This matches the doc comment on rawSourceMode ("no syntax hiding, no styling"), so I'm not filing it as a bug — but plain black text is a hard sell as a source view. Syntax colouring is most of what makes source readable, and it's the one thing every other source view has.
The other direction isn't available either. In the styled mode I can't ask for markers to stay on screen: MarkerStyle.hiddenMarkerFontSize controls how invisible an inactive marker is, not whether, and the shrink is unconditional.
Suggestion
Both needs meet at the same place. Marker hiding is centralised in one call:
// MarkdownASTStyler.swift:80
shrinkInactiveMarkers(in: blocks, ctx: ctx, into: &attrs)
so an opt-in flag on MarkdownEditorConfiguration covers it:
/// Default true — current behaviour.
public var hidesInactiveMarkers: Bool
With it off you get a source-style pane that is still fully styled: headings stay large, code blocks keep their background and their syntax highlighting, and markers render in theme.mutedText at their normal size — which is exactly what an active span already looks like, applied everywhere.
Three block markers hide outside that central pass and need the same condition: the blockquote > (:740), the fenced-code fences (:765), and an extension block's fences (:684). The sites that hide a substituted glyph — task checkboxes, list bullets, thematic breaks, image embeds, LaTeX — must keep hiding, or the glyph and its source would both draw.
I've implemented this and I'm opening a PR against it: 8 tests, full suite green (478), default behaviour byte-identical.
I realise this cuts against the live-styling design the engine is built around, which is why it's strictly opt-in rather than a change to rawSourceMode's contract. Happy to reshape it — including moving it onto rawSourceMode instead — if you'd rather it lived elsewhere.
Environment
macOS 15.7.9, Xcode 26.3, Swift 6.2.4, MarkdownEngine main (08ff3c0)
Use case
I'm building a two-pane Markdown app for macOS — raw source on the left, rendered preview on the right, the classic Typora split. The preview pane is
isEditable: falseand looks great out of the box. The source pane is where I got stuck.What I hit
rawSourceModeshows the source, but with no colouring at all — not the Markdown syntax, and not fenced code blocks either, becauserestyleTextViewreturns before the styling pass ever runs:So
MarkdownEngineCodeBlockshas no effect in that mode. This matches the doc comment onrawSourceMode("no syntax hiding, no styling"), so I'm not filing it as a bug — but plain black text is a hard sell as a source view. Syntax colouring is most of what makes source readable, and it's the one thing every other source view has.The other direction isn't available either. In the styled mode I can't ask for markers to stay on screen:
MarkerStyle.hiddenMarkerFontSizecontrols how invisible an inactive marker is, not whether, and the shrink is unconditional.Suggestion
Both needs meet at the same place. Marker hiding is centralised in one call:
so an opt-in flag on
MarkdownEditorConfigurationcovers it:With it off you get a source-style pane that is still fully styled: headings stay large, code blocks keep their background and their syntax highlighting, and markers render in
theme.mutedTextat their normal size — which is exactly what an active span already looks like, applied everywhere.Three block markers hide outside that central pass and need the same condition: the blockquote
>(:740), the fenced-code fences (:765), and an extension block's fences (:684). The sites that hide a substituted glyph — task checkboxes, list bullets, thematic breaks, image embeds, LaTeX — must keep hiding, or the glyph and its source would both draw.I've implemented this and I'm opening a PR against it: 8 tests, full suite green (478), default behaviour byte-identical.
I realise this cuts against the live-styling design the engine is built around, which is why it's strictly opt-in rather than a change to
rawSourceMode's contract. Happy to reshape it — including moving it ontorawSourceModeinstead — if you'd rather it lived elsewhere.Environment
macOS 15.7.9, Xcode 26.3, Swift 6.2.4, MarkdownEngine
main(08ff3c0)