bytecodealliance / bytecodealliance/component-docs

Add syntax highlighting to WIT documentation

Offen
#238 7 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @mkatychev Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
137
Forks
88
Ø Merge
5 T. 12 Std.
Gemergte PRs (30 T.)
4

Beschreibung

WIT code is currently unhighlighted as [highlight.js](https://highlightjs.org/) does not support WIT currently. Using the [`mdbook-treesitter`](https://github.com/Corpauration/mdbook-treesitter) preprocessor is a good avenue to add syntax highlighting for all WIT codeblocks in the documentation, working example of it in action:
https://mkatychev.github.io/component-docs/design/wit.html#worlds

Caveat:
Current `mdbook-treesitter` outputs grammar logic used for highlighting as [dylib file](https://github.com/Corpauration/mdbook-treesitter) (`wit.so`) and work is needed adding emscripten support to output a `wit.wasm` grammar file.

Create issues in https://github.com/bytecodealliance/vscode-wit and https://github.com/liamwh/tree-sitter-wit to support newer component model syntaxes:
- [x] Sized lists: [`list`](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md#:~:text=list%3Cu8%2C%204%3E;)
- [x] [feature gates](https://github.com/mkatychev/tree-sitter-wit/commit/9edb9528bc69fcb4552aa0cfd9d3c50b78946807)
- [x] [`stream` and `future` types](https://github.com/liamwh/tree-sitter-wit/pull/15)
- [x] [nested comments](https://github.com/mkatychev/tree-sitter-wit/commit/129157bfad15f9c3c142c60625ef3cd88b33e453)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.