blockquote borders and horizontal rule drawing
This commit is contained in:
parent
85af7f1029
commit
d1efbed9a8
|
|
@ -580,19 +580,22 @@ private func highlightMarkdownLine(_ trimmed: String, line: String, lineRange: N
|
|||
return true
|
||||
}
|
||||
|
||||
if trimmed.hasPrefix("> ") {
|
||||
if trimmed.hasPrefix("> ") || trimmed == ">" {
|
||||
textStorage.addAttribute(.foregroundColor, value: palette.overlay2, range: lineRange)
|
||||
let indent = NSMutableParagraphStyle()
|
||||
indent.headIndent = 20
|
||||
indent.firstLineHeadIndent = 20
|
||||
indent.headIndent = 24
|
||||
indent.firstLineHeadIndent = 24
|
||||
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
|
||||
}
|
||||
|
||||
// Horizontal rule
|
||||
// Horizontal rule — layout manager draws the line; mute the source text
|
||||
if isHorizontalRule(trimmed) {
|
||||
textStorage.addAttribute(.foregroundColor, value: palette.overlay0, range: lineRange)
|
||||
textStorage.addAttribute(.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: lineRange)
|
||||
textStorage.addAttribute(.foregroundColor, value: palette.surface0, range: lineRange)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue