mkdocs-texsmith 0.0.2.dev0__py3-none-any.whl
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.
- mkdocs_plugin_texsmith/__init__.py +6 -0
- mkdocs_plugin_texsmith/plugin.py +1428 -0
- mkdocs_texsmith-0.0.2.dev0.dist-info/METADATA +157 -0
- mkdocs_texsmith-0.0.2.dev0.dist-info/RECORD +7 -0
- mkdocs_texsmith-0.0.2.dev0.dist-info/WHEEL +4 -0
- mkdocs_texsmith-0.0.2.dev0.dist-info/entry_points.txt +2 -0
- mkdocs_texsmith-0.0.2.dev0.dist-info/licenses/LICENSE.md +21 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mkdocs-texsmith
|
|
3
|
+
Version: 0.0.2.dev0
|
|
4
|
+
Summary: Convert MkDocs documentation to LaTeX PDF.
|
|
5
|
+
Project-URL: Homepage, https://github.com/yves-chevallier/mkdocs-texsmith
|
|
6
|
+
Author-email: Yves Chevallier <yves.chevalier@heig-vd.ch>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE.md
|
|
9
|
+
Keywords: convert,extensions,latex,markdown,mkdocs,texsmith
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: texsmith==0.0.2.dev0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# MkDocs TeXSmith Plugin
|
|
21
|
+
|
|
22
|
+
`mkdocs-texsmith` turns any MkDocs project into a set of LaTeX sources ready for high-quality PDF production. The plugin reuses the TeXSmith rendering pipeline to transform the pages that MkDocs renders into TeX, keeping navigation structure, numbering, cross references, and assets in sync.
|
|
23
|
+
|
|
24
|
+
## Highlights
|
|
25
|
+
|
|
26
|
+
- Export one or many "books" from the same MkDocs site, each with its own metadata and output folder.
|
|
27
|
+
- Reuse TeXSmith templates or override individual blocks to match your house style.
|
|
28
|
+
- Combine global `.bib` files, per-book bibliographies, inline citations, and DOI lookups into a single bibliography.
|
|
29
|
+
- Copy and prune assets automatically so only referenced images end up in the LaTeX project.
|
|
30
|
+
- Optional HTML snapshots for debugging, plus Material for MkDocs specific tweaks out of the box.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install mkdocs-texsmith
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The package targets Python 3.12+. If you manage dependencies with [uv](https://github.com/astral-sh/uv), run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv add mkdocs-texsmith
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
1. Add the plugin to your `mkdocs.yml`.
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
plugins:
|
|
50
|
+
- search
|
|
51
|
+
- texsmith:
|
|
52
|
+
build_dir: press # where LaTeX sources are written
|
|
53
|
+
template: book # TeXSmith template to use
|
|
54
|
+
bibliography:
|
|
55
|
+
- docs/references.bib
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. Build your site as usual:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
mkdocs build
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. The LaTeX project for each configured book is created under `press/`. Compile the resulting `index.tex` with your preferred tool (`latexmk`, `tectonic`, etc.) to produce the PDF.
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
All plugin options are declared under the `texsmith` plugin entry.
|
|
69
|
+
|
|
70
|
+
- `enabled` (bool): turns the plugin on or off; automatically disabled during `mkdocs serve`.
|
|
71
|
+
- `build_dir` (str): output root for generated LaTeX projects. Defaults to `press`.
|
|
72
|
+
- `template` (str): default TeXSmith template name. Falls back to `book`.
|
|
73
|
+
- `parser` (str): HTML parser backend used by TeXSmith (`lxml` by default).
|
|
74
|
+
- `copy_assets` (bool): copy images and other assets referenced by the book into the build directory.
|
|
75
|
+
- `clean_assets` (bool): remove unused files from the generated `assets/` folder after rendering.
|
|
76
|
+
- `save_html` (bool): if `true`, store the rendered HTML alongside LaTeX snapshots under `html/`.
|
|
77
|
+
- `language` (str): override auto-detected language for templates and hyphenation.
|
|
78
|
+
- `bibliography` (list[str]): global `.bib` files applied to every book.
|
|
79
|
+
- `books` (list[dict]): per-book configuration (see below).
|
|
80
|
+
- `template_overrides` (dict[str, str]): map of template block names to override files.
|
|
81
|
+
- `register_material` (bool): register Material for MkDocs specific renderers (enabled by default).
|
|
82
|
+
|
|
83
|
+
### Multiple books
|
|
84
|
+
|
|
85
|
+
The `books` list lets you export distinct artefacts from the same site. Each entry accepts [`BookConfig`](../../src/texsmith/core/config.py) fields plus book-specific extras (`template`, `template_overrides`, `bibliography`):
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
plugins:
|
|
89
|
+
- texsmith:
|
|
90
|
+
books:
|
|
91
|
+
- title: "User Guide"
|
|
92
|
+
root: "Guide"
|
|
93
|
+
folder: "user-guide"
|
|
94
|
+
template: book
|
|
95
|
+
bibliography:
|
|
96
|
+
- docs/guide.bib
|
|
97
|
+
- title: "API Reference"
|
|
98
|
+
root: "Reference"
|
|
99
|
+
base_level: 2
|
|
100
|
+
copy_files:
|
|
101
|
+
docs/appendix/*.tex: backmatter/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
If you do not declare any books, the plugin creates one automatically using the first navigation page as the root section.
|
|
105
|
+
|
|
106
|
+
### Bibliography sources
|
|
107
|
+
|
|
108
|
+
- Global `bibliography` files apply to every book.
|
|
109
|
+
- Book-level `bibliography` entries augment or override the global list.
|
|
110
|
+
- YAML front matter can declare inline bibliography entries, including DOI links. DOIs are resolved at build time; failures are logged but do not stop the build.
|
|
111
|
+
- Per-book `.bib` files are emitted with the LaTeX project, and an `assets_map.yml` manifest records the asset locations used by the renderer.
|
|
112
|
+
|
|
113
|
+
### Templates and overrides
|
|
114
|
+
|
|
115
|
+
TeXSmith templates bundle LaTeX, Jinja, and formatter fragments. Set `template` globally or per book, then override specific fragments via `template_overrides`:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
plugins:
|
|
119
|
+
- texsmith:
|
|
120
|
+
template: book
|
|
121
|
+
template_overrides:
|
|
122
|
+
heading: overrides/heading.j2
|
|
123
|
+
books:
|
|
124
|
+
- title: "Whitepaper"
|
|
125
|
+
template_overrides:
|
|
126
|
+
cover: overrides/custom_cover.tex.j2
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The plugin automatically registers TeXSmith's Material integration when `register_material` is `true`, aligning colors and fonts with the Material theme if you use it.
|
|
130
|
+
|
|
131
|
+
### Assets and HTML snapshots
|
|
132
|
+
|
|
133
|
+
- `copy_assets: true` copies images and other referenced files into `<build_dir>/<book>/assets/`.
|
|
134
|
+
- `clean_assets: true` prunes unused files after rendering, keeping the LaTeX project tidy.
|
|
135
|
+
- Enable `save_html` to keep the intermediate HTML for each page under `<build_dir>/<book>/html/`, which helps when troubleshooting rendering issues.
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
1. Clone the repository and install dependencies:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
uv sync
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
2. Run the documentation site locally:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
uv run mkdocs serve
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
3. Use `pytest` or `uv run pytest` to execute tests before contributing patches.
|
|
152
|
+
|
|
153
|
+
The repository maintains a `Makefile` shortcut (`make deps`) that mirrors the `uv sync` step.
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
The project is distributed under the MIT License. See `LICENSE.md` for the full text.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
mkdocs_plugin_texsmith/__init__.py,sha256=YO_yRdtojJvjdEO5FWDQ7S3PUhaaWRtcSCumfcB50ps,96
|
|
2
|
+
mkdocs_plugin_texsmith/plugin.py,sha256=SyLWiI3LutSp7EKqucECCTBNI4NFJUGQzn8Ine2mjXw,53910
|
|
3
|
+
mkdocs_texsmith-0.0.2.dev0.dist-info/METADATA,sha256=BTnBpjYHuJDd3MZtlRRHetIr6OUKqPlRBCMFYtFwHE4,6072
|
|
4
|
+
mkdocs_texsmith-0.0.2.dev0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
5
|
+
mkdocs_texsmith-0.0.2.dev0.dist-info/entry_points.txt,sha256=hPPD4tbTS19gLtCR-GSMMMojBp3SWHZmiElEh9GOM6g,63
|
|
6
|
+
mkdocs_texsmith-0.0.2.dev0.dist-info/licenses/LICENSE.md,sha256=cGypyOtV6cq8aMvQvtj_3GdN2YDxl37sq5GD9GN8cWA,1066
|
|
7
|
+
mkdocs_texsmith-0.0.2.dev0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Isaac Muse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|