diff --git a/src/EditorView.swift b/src/EditorView.swift index 09aba9d..e5cf9be 100644 --- a/src/EditorView.swift +++ b/src/EditorView.swift @@ -1206,6 +1206,21 @@ func applySyntaxHighlighting(to textStorage: NSTextStorage) { } private func highlightMarkdownLine(_ trimmed: String, line: String, lineRange: NSRange, textStorage: NSTextStorage, baseFont: NSFont, palette: CatppuccinPalette, isTableHeader: Bool = false) -> Bool { + if trimmed.hasPrefix("### ") { + let hashRange = (textStorage.string as NSString).range(of: "###", range: lineRange) + if hashRange.location != NSNotFound { + textStorage.addAttribute(.foregroundColor, value: palette.overlay0, range: hashRange) + let contentStart = hashRange.location + hashRange.length + let contentRange = NSRange(location: contentStart, length: NSMaxRange(lineRange) - contentStart) + if contentRange.length > 0 { + let h3Font = NSFont.systemFont(ofSize: 15, weight: .bold) + textStorage.addAttribute(.font, value: h3Font, range: contentRange) + textStorage.addAttribute(.foregroundColor, value: palette.text, range: contentRange) + } + } + return true + } + if trimmed.hasPrefix("## ") { let hashRange = (textStorage.string as NSString).range(of: "##", range: lineRange) if hashRange.location != NSNotFound {