blockquote borders and horizontal rule drawing

This commit is contained in:
jess 2026-04-04 22:43:56 -07:00
parent 85af7f1029
commit d1efbed9a8
1 changed files with 9 additions and 6 deletions

View File

@ -580,19 +580,22 @@ private func highlightMarkdownLine(_ trimmed: String, line: String, lineRange: N
return true return true
} }
if trimmed.hasPrefix("> ") { if trimmed.hasPrefix("> ") || trimmed == ">" {
textStorage.addAttribute(.foregroundColor, value: palette.overlay2, range: lineRange) textStorage.addAttribute(.foregroundColor, value: palette.overlay2, range: lineRange)
let indent = NSMutableParagraphStyle() let indent = NSMutableParagraphStyle()
indent.headIndent = 20 indent.headIndent = 24
indent.firstLineHeadIndent = 20 indent.firstLineHeadIndent = 24
textStorage.addAttribute(.paragraphStyle, value: indent, range: lineRange) textStorage.addAttribute(.paragraphStyle, value: indent, range: lineRange)
let gtRange = (textStorage.string as NSString).range(of: ">", options: [], range: lineRange)
if gtRange.location != NSNotFound {
textStorage.addAttribute(.foregroundColor, value: palette.overlay0, range: gtRange)
}
return true return true
} }
// Horizontal rule // Horizontal rule layout manager draws the line; mute the source text
if isHorizontalRule(trimmed) { if isHorizontalRule(trimmed) {
textStorage.addAttribute(.foregroundColor, value: palette.overlay0, range: lineRange) textStorage.addAttribute(.foregroundColor, value: palette.surface0, range: lineRange)
textStorage.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: lineRange)
return true return true
} }