Skip to content

Commit a325284

Browse files
author
Zachary Lineman
committed
Added link to documentation web url.
1 parent 7191f7b commit a325284

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/Highlighter/Markdown.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ public class Markdown {
183183
}
184184
}
185185

186+
let header4Font = FireflyFont.systemFont(ofSize: fontSize * 1.4)
187+
let header4Regex = try? NSRegularExpression(pattern: "#### (.*?\n)", options: [])
188+
if let matches = header4Regex?.matches(in: attributedString.string, options: [], range: NSRange(location: 0, length: attributedString.length)) {
189+
for aMatch in matches.reversed() {
190+
guard let tRange = Range(aMatch.range(at: 1), in: attributedString.string) else { break }
191+
let text: String = String(attributedString.string[tRange])
192+
193+
let nString = NSAttributedString(string: text, attributes: [NSAttributedString.Key.font: header4Font, NSAttributedString.Key.foregroundColor: tColor])
194+
attributedString.replaceCharacters(in: aMatch.range, with: nString)
195+
}
196+
}
197+
186198
let header3Font = FireflyFont.systemFont(ofSize: fontSize * 1.7)
187199
let header3Regex = try? NSRegularExpression(pattern: "### (.*?\n)", options: [])
188200
if let matches = header3Regex?.matches(in: attributedString.string, options: [], range: NSRange(location: 0, length: attributedString.length)) {

0 commit comments

Comments
 (0)