Expand description
mdbook-treesitter — an mdBook preprocessor that replaces
{{ #treesitter <path>#<query>?<params> }} directives with the code
extracted from the referenced source file using tree-sitter queries.
§Directive syntax
{{ #treesitter path/to/file.rs }}
{{ #treesitter path/to/file.rs#query_name }}
{{ #treesitter path/to/file.rs#query_name?param1=val1¶m2=val2 }}The space around the braces is optional:
{{#treesitter path/to/file.rs#doc_comment?name=Foo}}Modules§
- config
- Configuration types for the mdbook-treesitter preprocessor.
- language
- Language registry: maps file extensions to tree-sitter parsers.
- query
- Query execution: runs either a tree-sitter S-expression query or a jq filter against a source file and returns the matching code text.
Structs§
- Directive
- A parsed
#treesitterdirective. - Treesitter
Preprocessor - The
mdbook-treesitterpreprocessor.
Functions§
- process_
chapter - Replace all
{{ #treesitter ... }}directives incontentwith the extracted code. Directives that fail to resolve are reported as errors.