Skip to content

Commit 6d70032

Browse files
authored
Merge pull request #201 from MarcoCarnevali/fix/code-editor-load
fix: code editor highlight load
2 parents 9c641ee + c2ed613 commit 6d70032

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CodeEditModules/Modules/CodeFile/src/CodeEditor.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ struct CodeEditor: NSViewRepresentable {
3737
scrollView: scrollView
3838
)
3939
)
40+
41+
if let highlightr = highlightr,
42+
let string = highlightr.highlight(
43+
content.wrappedValue,
44+
as: language?.rawValue,
45+
fastRender: true
46+
) {
47+
textView.textStorage?.append(string)
48+
}
49+
4050
textView.autoresizingMask = .width
4151
textView.maxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)
4252
textView.minSize = NSSize(width: 0, height: scrollView.contentSize.height)

CodeEditModules/Modules/CodeFile/src/Model/Language.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ extension CodeEditor {
8484
case haxe
8585
case hsp
8686
case htmlbars
87+
case html
8788
case http
8889
case hy
8990
case inform7

0 commit comments

Comments
 (0)