hide raw markdown text behind table GUI elements
This commit is contained in:
parent
3be834f22e
commit
8f4f1fddc7
|
|
@ -1496,27 +1496,8 @@ private func highlightFootnoteDefinition(textStorage: NSTextStorage, lineRange:
|
||||||
// MARK: - Tables
|
// MARK: - Tables
|
||||||
|
|
||||||
private func highlightTableLine(_ trimmed: String, lineRange: NSRange, textStorage: NSTextStorage, palette: CatppuccinPalette, baseFont: NSFont, isHeader: Bool, isSeparator: Bool) {
|
private func highlightTableLine(_ trimmed: String, lineRange: NSRange, textStorage: NSTextStorage, palette: CatppuccinPalette, baseFont: NSFont, isHeader: Bool, isSeparator: Bool) {
|
||||||
let monoFont = NSFont.monospacedSystemFont(ofSize: baseFont.pointSize, weight: .regular)
|
textStorage.addAttribute(.foregroundColor, value: palette.base, range: lineRange)
|
||||||
let boldMono = NSFontManager.shared.convert(monoFont, toHaveTrait: .boldFontMask)
|
textStorage.addAttribute(.font, value: NSFont.systemFont(ofSize: 0.01), range: lineRange)
|
||||||
|
|
||||||
textStorage.addAttribute(.font, value: monoFont, range: lineRange)
|
|
||||||
textStorage.addAttribute(.foregroundColor, value: palette.text, range: lineRange)
|
|
||||||
|
|
||||||
if isSeparator {
|
|
||||||
textStorage.addAttribute(.foregroundColor, value: palette.overlay0, range: lineRange)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if isHeader {
|
|
||||||
textStorage.addAttribute(.font, value: boldMono, range: lineRange)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mute pipe delimiters
|
|
||||||
guard let pipeRegex = try? NSRegularExpression(pattern: "\\|") else { return }
|
|
||||||
let matches = pipeRegex.matches(in: textStorage.string, range: lineRange)
|
|
||||||
for match in matches {
|
|
||||||
textStorage.addAttribute(.foregroundColor, value: palette.overlay0, range: match.range)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Lists and Horizontal Rules
|
// MARK: - Lists and Horizontal Rules
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue