sphinx-rustdoc-postprocess 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. sphinx_rustdoc_postprocess-0.1.0/.claude/settings.local.json +18 -0
  2. sphinx_rustdoc_postprocess-0.1.0/.github/workflows/ci.yml +34 -0
  3. sphinx_rustdoc_postprocess-0.1.0/.github/workflows/doc_commenter.yml +23 -0
  4. sphinx_rustdoc_postprocess-0.1.0/.github/workflows/docs.yml +63 -0
  5. sphinx_rustdoc_postprocess-0.1.0/.github/workflows/pre_commit.yml +21 -0
  6. sphinx_rustdoc_postprocess-0.1.0/.gitignore +23 -0
  7. sphinx_rustdoc_postprocess-0.1.0/.pre-commit-config.yaml +14 -0
  8. sphinx_rustdoc_postprocess-0.1.0/.python-version +1 -0
  9. sphinx_rustdoc_postprocess-0.1.0/CHANGELOG.md +5 -0
  10. sphinx_rustdoc_postprocess-0.1.0/CODEOWNERS +13 -0
  11. sphinx_rustdoc_postprocess-0.1.0/CODE_OF_CONDUCT.md +132 -0
  12. sphinx_rustdoc_postprocess-0.1.0/LICENSE +19 -0
  13. sphinx_rustdoc_postprocess-0.1.0/PKG-INFO +258 -0
  14. sphinx_rustdoc_postprocess-0.1.0/README.md +247 -0
  15. sphinx_rustdoc_postprocess-0.1.0/docs/export.el +25 -0
  16. sphinx_rustdoc_postprocess-0.1.0/docs/orgmode/index.org +61 -0
  17. sphinx_rustdoc_postprocess-0.1.0/docs/orgmode/usage.org +78 -0
  18. sphinx_rustdoc_postprocess-0.1.0/docs/source/conf.py +30 -0
  19. sphinx_rustdoc_postprocess-0.1.0/docs/source/index.rst +61 -0
  20. sphinx_rustdoc_postprocess-0.1.0/docs/source/usage.rst +98 -0
  21. sphinx_rustdoc_postprocess-0.1.0/news/.gitkeep +0 -0
  22. sphinx_rustdoc_postprocess-0.1.0/pixi.lock +2167 -0
  23. sphinx_rustdoc_postprocess-0.1.0/pixi.toml +31 -0
  24. sphinx_rustdoc_postprocess-0.1.0/pyproject.toml +39 -0
  25. sphinx_rustdoc_postprocess-0.1.0/readme_src.org +207 -0
  26. sphinx_rustdoc_postprocess-0.1.0/src/sphinx_rustdoc_postprocess/__init__.py +320 -0
  27. sphinx_rustdoc_postprocess-0.1.0/src/sphinx_rustdoc_postprocess/_version.py +34 -0
  28. sphinx_rustdoc_postprocess-0.1.0/src/sphinx_rustdoc_postprocess/py.typed +0 -0
  29. sphinx_rustdoc_postprocess-0.1.0/tests/__init__.py +0 -0
  30. sphinx_rustdoc_postprocess-0.1.0/tests/conftest.py +56 -0
  31. sphinx_rustdoc_postprocess-0.1.0/tests/test_convert_fences.py +55 -0
  32. sphinx_rustdoc_postprocess-0.1.0/tests/test_convert_headings.py +46 -0
  33. sphinx_rustdoc_postprocess-0.1.0/tests/test_convert_links.py +60 -0
  34. sphinx_rustdoc_postprocess-0.1.0/tests/test_convert_tables.py +52 -0
  35. sphinx_rustdoc_postprocess-0.1.0/tests/test_postprocess.py +123 -0
  36. sphinx_rustdoc_postprocess-0.1.0/tests/test_setup.py +46 -0
  37. sphinx_rustdoc_postprocess-0.1.0/uv.lock +934 -0
@@ -0,0 +1,18 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "WebFetch(domain:pydissem.rgoswami.me)",
5
+ "WebSearch",
6
+ "WebFetch(domain:www.sphinx-doc.org)",
7
+ "WebFetch(domain:github.com)",
8
+ "Bash(uv sync:*)",
9
+ "Bash(uv run pytest:*)",
10
+ "Bash(uv run ruff check:*)",
11
+ "Bash(uv run ruff format:*)",
12
+ "Bash(uv run python:*)",
13
+ "Bash(uv build:*)",
14
+ "WebFetch(domain:rgpot.rgoswami.me)",
15
+ "Bash(ls:*)"
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.10", "3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: astral-sh/setup-uv@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+
21
+ - name: Install pandoc
22
+ run: sudo apt-get update && sudo apt-get install -y pandoc
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --all-groups
26
+
27
+ - name: Lint
28
+ run: uv run ruff check src tests
29
+
30
+ - name: Format check
31
+ run: uv run ruff format --check src tests
32
+
33
+ - name: Test
34
+ run: uv run pytest --cov
@@ -0,0 +1,23 @@
1
+ name: Comment on pull request
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Build and Deploy Documentation"]
6
+ types: [completed]
7
+
8
+ jobs:
9
+ pr_comment:
10
+ if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ pull-requests: write
14
+ issues: write
15
+ actions: read
16
+
17
+ steps:
18
+ - uses: HaoZeke/doc-previewer@v0.0.1
19
+ with:
20
+ workflow_run_id: ${{ github.event.workflow_run.id }}
21
+ head_sha: ${{ github.event.workflow_run.head_sha }}
22
+ artifact_name: documentation
23
+ comment_header: "### Documentation Preview"
@@ -0,0 +1,63 @@
1
+ name: Build and Deploy Documentation
2
+
3
+ concurrency:
4
+ group: "pages"
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ push:
9
+ branches: [main]
10
+ tags: ["*"]
11
+ pull_request:
12
+
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ jobs:
19
+ build_docs:
20
+ name: Build documentation
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - uses: prefix-dev/setup-pixi@v0.8.10
29
+ with:
30
+ cache: true
31
+ cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
32
+ environments: >-
33
+ docs
34
+
35
+ - name: Install Python dependencies
36
+ run: pixi run sync
37
+
38
+ - name: Build docs
39
+ run: pixi run -e docs docbld
40
+
41
+ - name: Upload artifact
42
+ uses: actions/upload-artifact@v4
43
+ with:
44
+ name: documentation
45
+ path: docs/build/html
46
+
47
+ - name: Upload pages artifact
48
+ if: github.event_name == 'push'
49
+ uses: actions/upload-pages-artifact@v3
50
+ with:
51
+ path: docs/build/html
52
+
53
+ deploy:
54
+ if: github.event_name == 'push'
55
+ needs: build_docs
56
+ runs-on: ubuntu-latest
57
+ environment:
58
+ name: github-pages
59
+ url: ${{ steps.deployment.outputs.page_url }}
60
+ steps:
61
+ - name: Deploy to GitHub Pages
62
+ id: deployment
63
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,21 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ pre-commit:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ fetch-depth: 0
15
+ - name: Run precommit
16
+ run: |
17
+ pipx run prek run -a
18
+ - name: Audit for large files
19
+ uses: HaoZeke/large-file-auditor@v0.1.0
20
+ with:
21
+ file-size-threshold: "1M"
@@ -0,0 +1,23 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Generated version file
13
+ src/sphinx_rustdoc_postprocess/_version.py
14
+
15
+ # Docs build
16
+ docs/build/
17
+
18
+ # Pixi
19
+ .pixi/
20
+ *.pixi
21
+
22
+ # Ruff
23
+ .ruff_cache/
@@ -0,0 +1,14 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ - repo: https://github.com/astral-sh/ruff-pre-commit
10
+ rev: v0.9.7
11
+ hooks:
12
+ - id: ruff
13
+ args: [--fix]
14
+ - id: ruff-format
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ <!-- towncrier release notes start -->
@@ -0,0 +1,13 @@
1
+ # This is a comment.
2
+ # Each line is a file pattern followed by one or more owners.
3
+
4
+ # These owners will be the default owners for everything in
5
+ # the repo. Unless a later match takes precedence,
6
+ # @global-owner1 and @global-owner2 will be requested for
7
+ # review when someone opens a pull request.
8
+ * @HaoZeke
9
+
10
+ # Order is important; the last matching pattern takes the most
11
+ # precedence. When someone opens a pull request that only
12
+ # modifies JS files, for example, only @js-owner and not the global
13
+ # owner(s) will be requested for a review.
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,19 @@
1
+ MIT License Copyright (c) 2026 Rohit Goswami <rgoswami[at]ieee.org>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice (including the next
11
+ paragraph) shall be included in all copies or substantial portions of the
12
+ Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19
+ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: sphinx-rustdoc-postprocess
3
+ Version: 0.1.0
4
+ Summary: Post-process sphinxcontrib-rust RST output, converting leftover markdown to proper RST via pandoc.
5
+ Author-email: Rohit Goswami <rgoswami@ieee.org>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: sphinx>=7
10
+ Description-Content-Type: text/markdown
11
+
12
+
13
+
14
+ # sphinx-rustdoc-postprocess
15
+
16
+ Post-process [sphinxcontrib-rust](https://github.com/aspect-build/sphinxcontrib-rust) RST output, converting leftover markdown
17
+ fragments (code fences, tables, links, headings, inline code) to proper RST
18
+ via [pandoc](https://pandoc.org/).
19
+
20
+
21
+ ## The problem
22
+
23
+ [sphinxcontrib-rust](https://github.com/aspect-build/sphinxcontrib-rust) generates RST files from Rust crates, but `rustdoc`
24
+ doc-comments are written in markdown. The generated RST ends up with markdown
25
+ fragments embedded verbatim inside directive bodies, which Sphinx cannot render
26
+ correctly.
27
+
28
+ For a real-world example, see [rgpot](https://rgpot.rgoswami.me/) ([source](https://github.com/HaoZeke/rgpot)), which uses this extension to
29
+ document its Rust core library alongside C++ API docs.
30
+
31
+
32
+ ### Before (raw sphinxcontrib-rust output)
33
+
34
+ Given Rust doc-comments like these in `lib.rs`:
35
+
36
+ //! ## Module Overview
37
+ //!
38
+ //! | Module | Purpose |
39
+ //! |--------|---------|
40
+ //! | [`types`] | `#[repr(C)]` data structures for force/energy I/O |
41
+ //! | [`tensor`] | DLPack tensor helpers |
42
+
43
+ sphinxcontrib-rust produces RST with the markdown still intact inside
44
+ directives:
45
+
46
+ .. py:module:: rgpot_core
47
+
48
+ ## Module Overview
49
+
50
+ | Module | Purpose |
51
+ |--------|---------|
52
+ | [`types`] | `#[repr(C)]` data structures for force/energy I/O |
53
+ | [`tensor`] | DLPack tensor helpers |
54
+
55
+ This renders incorrectly in Sphinx: headings inside directives break the
56
+ document structure, markdown tables appear as literal pipe characters, and
57
+ single-backtick code is not valid RST.
58
+
59
+
60
+ ### After (postprocessed output)
61
+
62
+ After this extension runs, the same file becomes:
63
+
64
+ .. py:module:: rgpot_core
65
+
66
+ **Module Overview**
67
+
68
+ +------------+----------------------------------------------------+
69
+ | Module | Purpose |
70
+ +============+====================================================+
71
+ | ``types`` | ``#[repr(C)]`` data structures for force/energy IO |
72
+ +------------+----------------------------------------------------+
73
+ | ``tensor`` | DLPack tensor helpers |
74
+ +------------+----------------------------------------------------+
75
+
76
+ Similarly, markdown code fences:
77
+
78
+ ```c
79
+ rgpot_status_t s = rgpot_potential_calculate(pot, &input, &output);
80
+ if (s != RGPOT_SUCCESS) {
81
+ fprintf(stderr, "rgpot error: %s\n", rgpot_last_error());
82
+ }
83
+ ```
84
+
85
+ become proper RST code-block directives:
86
+
87
+ .. code-block:: c
88
+
89
+ rgpot_status_t s = rgpot_potential_calculate(pot, &input, &output);
90
+ if (s != RGPOT_SUCCESS) {
91
+ fprintf(stderr, "rgpot error: %s\n", rgpot_last_error());
92
+ }
93
+
94
+ And markdown links like `[metatensor](https://docs.metatensor.org/)` become
95
+ `` `metatensor <https://docs.metatensor.org/>`_ ``, while rustdoc intra-doc links
96
+ like ``[`types`]`` become `` ``types`` ``.
97
+
98
+
99
+ ## Installation
100
+
101
+ pip install sphinx-rustdoc-postprocess
102
+
103
+ Pandoc must be available on your `PATH`. See [pandoc.org](https://pandoc.org/installing.html) for installation
104
+ instructions.
105
+
106
+
107
+ ## Usage
108
+
109
+ Add to your Sphinx `conf.py`:
110
+
111
+ extensions = [
112
+ "sphinxcontrib_rust",
113
+ "sphinx_rustdoc_postprocess",
114
+ ]
115
+
116
+ The extension hooks into `builder-inited` at priority 600 (after
117
+ sphinxcontrib-rust's default 500), so it automatically runs on the generated
118
+ RST files before Sphinx reads them.
119
+
120
+
121
+ ### Configuration
122
+
123
+ <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
124
+
125
+
126
+ <colgroup>
127
+ <col class="org-left" />
128
+
129
+ <col class="org-left" />
130
+
131
+ <col class="org-left" />
132
+ </colgroup>
133
+ <thead>
134
+ <tr>
135
+ <th scope="col" class="org-left">Config value</th>
136
+ <th scope="col" class="org-left">Default</th>
137
+ <th scope="col" class="org-left">Description</th>
138
+ </tr>
139
+ </thead>
140
+ <tbody>
141
+ <tr>
142
+ <td class="org-left"><code>rustdoc_postprocess_rst_dir</code></td>
143
+ <td class="org-left"><code>"crates"</code></td>
144
+ <td class="org-left">Subdirectory of <code>srcdir</code> to scan for RST files</td>
145
+ </tr>
146
+
147
+ <tr>
148
+ <td class="org-left"><code>rustdoc_postprocess_toctree_target</code></td>
149
+ <td class="org-left"><code>""</code></td>
150
+ <td class="org-left">RST file to inject a toctree snippet into (empty = skip)</td>
151
+ </tr>
152
+
153
+ <tr>
154
+ <td class="org-left"><code>rustdoc_postprocess_toctree_rst</code></td>
155
+ <td class="org-left"><code>""</code></td>
156
+ <td class="org-left">RST snippet to append to the target file (empty = skip)</td>
157
+ </tr>
158
+ </tbody>
159
+ </table>
160
+
161
+
162
+ ### Full configuration example
163
+
164
+ # conf.py
165
+ import os
166
+
167
+ extensions = [
168
+ "sphinxcontrib_rust",
169
+ "sphinx_rustdoc_postprocess",
170
+ ]
171
+
172
+ # sphinxcontrib-rust settings
173
+ rust_crates = {
174
+ "my_crate": os.path.abspath("../../my-crate/"),
175
+ }
176
+ rust_doc_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "crates")
177
+ rust_rustdoc_fmt = "rst"
178
+
179
+ # Inject a toctree entry for the Rust docs into an existing index page
180
+ rustdoc_postprocess_toctree_target = "api/index.rst"
181
+ rustdoc_postprocess_toctree_rst = """
182
+
183
+ Rust API
184
+ --------
185
+
186
+ .. toctree::
187
+ :maxdepth: 2
188
+
189
+ ../crates/my_crate/lib
190
+ """
191
+
192
+
193
+ ## What gets converted
194
+
195
+ <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
196
+
197
+
198
+ <colgroup>
199
+ <col class="org-left" />
200
+
201
+ <col class="org-left" />
202
+ </colgroup>
203
+ <thead>
204
+ <tr>
205
+ <th scope="col" class="org-left">Markdown construct</th>
206
+ <th scope="col" class="org-left">RST output</th>
207
+ </tr>
208
+ </thead>
209
+ <tbody>
210
+ <tr>
211
+ <td class="org-left"><code>```lang</code> code fences</td>
212
+ <td class="org-left"><code>.. code-block:: lang</code> directives</td>
213
+ </tr>
214
+
215
+ <tr>
216
+ <td class="org-left"><code>\vert table \vert</code> pipe tables</td>
217
+ <td class="org-left">RST grid tables (via pandoc)</td>
218
+ </tr>
219
+
220
+ <tr>
221
+ <td class="org-left"><code>[text](url)</code> links</td>
222
+ <td class="org-left"><code>`text &lt;url&gt;`_</code></td>
223
+ </tr>
224
+
225
+ <tr>
226
+ <td class="org-left"><code>[`Name`]</code> intra-doc links</td>
227
+ <td class="org-left"><code>``Name``</code></td>
228
+ </tr>
229
+
230
+ <tr>
231
+ <td class="org-left"><code>`code`</code> inline code</td>
232
+ <td class="org-left"><code>``code``</code></td>
233
+ </tr>
234
+
235
+ <tr>
236
+ <td class="org-left"><code>## Heading</code> ATX headings</td>
237
+ <td class="org-left"><code>**Heading**</code> (bold, since RST headings can't nest in directives)</td>
238
+ </tr>
239
+ </tbody>
240
+ </table>
241
+
242
+
243
+ ## Development
244
+
245
+ pixi install
246
+ pixi run test
247
+
248
+ A `pre-commit` job is setup on CI to enforce consistent styles, so it is best
249
+ to set it up locally as well (using [uvx](https://docs.astral.sh/uv/guides/tools/) for isolation):
250
+
251
+ # Run before committing
252
+ uvx pre-commit run --all-files
253
+
254
+
255
+ ## License
256
+
257
+ MIT
258
+