bytecodealliance / bytecodealliance/component-docs

Add syntax highlighting to WIT documentation

Đang mở
#238 7 bình luận 0 reaction 1 người được giao Được @mkatychev nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
137
Fork
88
Merge trung bình
5 ngày 12 giờ
Pull request đã merge (30 ngày)
4

Mô tả

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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.