Skip to content

Commit 148d029

Browse files
Fix markdown syntax highlighting by mapping capture names
The markdown tree-sitter grammar uses nvim-treesitter capture names (e.g. text.title, punctuation.special) that CaptureName.fromString() didn't recognize, causing all markdown highlights to be silently dropped. Map these to existing CaptureName cases so no new enum values or theme changes are needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1fa4d3c commit 148d029

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/CodeEditSourceEditor/Enums/CaptureName.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ public enum CaptureName: Int8, CaseIterable, Sendable {
9292
return .keywordReturn
9393
case "keyword.function":
9494
return .keywordFunction
95+
case "text.title", "text.strong", "punctuation.special":
96+
return .keyword
97+
case "text.literal", "text.uri", "string.escape":
98+
return .string
99+
case "text.reference":
100+
return .type
101+
case "text.emphasis":
102+
return .variable
103+
case "punctuation.delimiter":
104+
return .comment
105+
case "none":
106+
return nil
95107
default:
96108
return nil
97109
}

0 commit comments

Comments
 (0)