sphinxcontrib-tree-sitter
Use tree-sitter to highlight code blocks.
Usage
CLI
python -m sphinxcontrib.tree_sitter /the/path/of/a/file
sphinx
docs/conf.py:
extensions = [
"sphinxcontrib.tree_sitter",
]
pyproject.toml:
# ...
[project.optional-dependencies]
dev = [
"sphinx",
"tree-sitter-XXX",
]
uv sync
source .venv/bin/activate
sphinx-build docs _readthedocs/html
xdg-open _readthedocs/html/index.html
markdown-it-py
from markdown_it import MarkdownIt
from sphinxcontrib.tree_sitter.mdit_py_plugin import tree_sitter_plugin
md = MarkdownIt("commonmark", {"html": True}).use(tree_sitter_plugin)
code = md.render("""
```python
def f():
print("Hello")
""")
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinxcontrib_tree_sitter-0.0.3.tar.gz.
File metadata
- Download URL: sphinxcontrib_tree_sitter-0.0.3.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e056832f0c36910189a96241ea179c0527a21d150084a85a6678917cb3fcefd
|
|
| MD5 |
39fcb9ee743b876ce8559615e19ccdaa
|
|
| BLAKE2b-256 |
e17e171c91e3515283b668866633a170dc5f2916dcf86ba11563bd7bb06a51de
|
File details
Details for the file sphinxcontrib_tree_sitter-0.0.3-py3-none-any.whl.
File metadata
- Download URL: sphinxcontrib_tree_sitter-0.0.3-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07ffa0f09d099a30093901d4c13affe18a4a136d3f5c06485191b6d747fdfdd4
|
|
| MD5 |
16455ee9d6e1a6f7d76ffadbbfdc33ee
|
|
| BLAKE2b-256 |
1deb013cf34160dc8d8a5e10c3722d74ef83749ebf273a62f34490c9a1198c94
|