Skip to content

Add custom TextMate code language support#406

Open
rossirpaulo wants to merge 1 commit into
ZenNotes:mainfrom
rossirpaulo:agent/custom-code-languages
Open

Add custom TextMate code language support#406
rossirpaulo wants to merge 1 commit into
ZenNotes:mainfrom
rossirpaulo:agent/custom-code-languages

Conversation

@rossirpaulo

Copy link
Copy Markdown

Adds desktop support for importing self-contained TextMate JSON grammars and using their fence tags in both the editor and rendered Markdown.

Users can add, preview, enable, edit, reveal, and remove custom languages from Settings → Editor → Languages. Installed grammars are stored in the machine-wide ZenNotes config directory and update open editor and preview surfaces without changing note files.

The runtime keeps built-in language and diagram tags reserved, rejects grammars with unsupported external scope dependencies, bounds grammar and code-block sizes, and loads TextMate/Oniguruma only when needed. The Oniguruma WASM is embedded and decoded locally instead of fetched, so it works with Electron's CSP and packaged file URLs.

Validation completed:

  • 58 shared-domain tests
  • 804 app-core tests
  • custom-language desktop persistence tests
  • TypeScript checks for shared-domain, bridge-contract, app-core, web, and desktop
  • web and desktop production builds

@rossirpaulo
rossirpaulo marked this pull request as ready for review July 16, 2026 01:11
@rossirpaulo
rossirpaulo requested a review from adibhanna as a code owner July 16, 2026 01:11
@rossirpaulo

Copy link
Copy Markdown
Author

I'm adding this feature since I'm trying to move off Obsidian and I build a programming language. It's hard to move off if it means my snippets don't have custom highlighting. Hope this helps and gets merged. Lmk if you need help reviewing.

@rossirpaulo

Copy link
Copy Markdown
Author

@adibhanna, any steps that I need to take to get this PR some momentum? lmk if there's anything not documented in CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant