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")
""")
Metadata
Release files for sphinxcontrib-tree-sitter 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sphinxcontrib_tree_sitter-0.0.3.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinxcontrib_tree_sitter-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / sphinxcontrib_tree_sitter-0.0.3.tar.gz
| Download URL | sphinxcontrib_tree_sitter-0.0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e056832f0c36910189a96241ea179c0527a21d150084a85a6678917cb3fcefd
|
|
BLAKE2b-256 checksum How to use checksums |
e17e171c91e3515283b668866633a170dc5f2916dcf86ba11563bd7bb06a51de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / sphinxcontrib_tree_sitter-0.0.3-py3-none-any.whl
| Download URL | sphinxcontrib_tree_sitter-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07ffa0f09d099a30093901d4c13affe18a4a136d3f5c06485191b6d747fdfdd4
|
|
BLAKE2b-256 checksum How to use checksums |
1deb013cf34160dc8d8a5e10c3722d74ef83749ebf273a62f34490c9a1198c94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|