Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(open-knowledge): syntax-highlight JSON files in the code viewer (#2136)
Andrew Mikofalvyc3c5f8293631
diff --git a/.changeset/json-code-viewer-highlighting.md b/.changeset/json-code-viewer-highlighting.mdnew file mode 100644index 000000000..a9d5cacc0--- /dev/null+++ b/.changeset/json-code-viewer-highlighting.md@@ -0,0 +1,5 @@+---+"@inkeep/open-knowledge-app": patch+---++Fix: JSON files now render with syntax highlighting in the read-only code viewer. The extension-to-language table mapped `jsonc` to the JSON grammar but omitted plain `json`, so opening a `.json` file (for example `config.json`, `package.json`, or `.mcp.json`) resolved to no language and CodeMirror fell back to unhighlighted plaintext. Adding the `json` entry routes these files to the JSON grammar that was already available. The media-kind dispatch is unaffected — `.json` already resolved as a text asset through the sidebar text set, which is checked before the code-language set.diff --git a/packages/core/src/constants/code-languages.test.ts b/packages/core/src/constants/code-languages.test.tsindex bb01a658e..b4f467808 100644--- a/packages/core/src/constants/code-languages.test.ts+++ b/packages/core/src/constants/code-languages.test.ts@@ -22,6 +22,7 @@ describe('codeLanguageForExtension', () => {expect(codeLanguageForExtension('hpp')).toBe('cpp');expect(codeLanguageForExtension('yaml')).toBe('yaml');expect(codeLanguageForExtension('xml')).toBe('xml');+ expect(codeLanguageForExtension('json')).toBe('json');expect(codeLanguageForExtension('html')).toBeNull();expect(codeLanguageForExtension('htm')).toBeNull();expect(codeLanguageForExtension('svg')).toBeNull();@@ -60,6 +61,11 @@ describe('codeLanguageForExtension', () => {for (const alias of bashAliases) {expect(codeLanguageForExtension(alias)).toBe('bash');}++ const jsonAliases = ['json', 'jsonc'];+ for (const alias of jsonAliases) {+ expect(codeLanguageForExtension(alias)).toBe('json');+ }});});diff --git a/packages/core/src/constants/code-languages.ts b/packages/core/src/constants/code-languages.tsindex ff19585e4..8ed493ad9 100644--- a/packages/core/src/constants/code-languages.ts+++ b/packages/core/src/constants/code-languages.ts@@ -38,6 +38,7 @@ export const CODE_FILE_EXTENSIONS_TO_LANGUAGE: Readonly<Record<string, string>>mjs: 'javascript',cjs: 'javascript',+ json: 'json',jsonc: 'json',kt: 'kotlin',