chaptr 0.1.1__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.
chaptr-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: chaptr
3
+ Version: 0.1.1
4
+ Summary: Build independent Markdown document projects with shared variables and CSS themes.
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: markdown-it-py<5,>=3
8
+ Requires-Dist: mdit-py-plugins<1,>=0.5
9
+ Requires-Dist: PyYAML<7,>=6
10
+ Provides-Extra: pdf
11
+ Requires-Dist: WeasyPrint<70,>=68; extra == "pdf"
12
+ Requires-Dist: pypdf<7,>=6; extra == "pdf"
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest<10,>=8; extra == "dev"
15
+ Requires-Dist: pypdf<7,>=6; extra == "dev"
16
+
17
+ # chaptr
18
+
19
+ Turn separate Markdown chapters into one document, with shared variables and
20
+ editable themes. Produce merged Markdown, styled HTML or PDF.
21
+
22
+ ## Usage
23
+
24
+ chaptr runs in your terminal. Install it once and use it across document projects.
25
+ See [installation instructions](docs/01-requirements.md#installation) for the
26
+ source checkout and GitHub release wheel options.
27
+
28
+ | Command | Purpose |
29
+ | --- | --- |
30
+ | `chaptr init [directory]` | Create an editable copy of the app's documentation |
31
+ | `chaptr build` | Build the current project; HTML is the default |
32
+ | `chaptr build --format pdf` | Generate PDF when renderer dependencies are available |
33
+ | `chaptr help` | Read the bundled command manual |
34
+ | `chaptr --help` | List commands; each command also supports `--help` |
35
+
36
+ See the [documentation](docs/README.md) for requirements, the user workflow,
37
+ configuration, themes and current limitations. The documentation is itself an
38
+ chaptr project, so you can try the tool on its own source:
39
+
40
+ ```sh
41
+ chaptr build --config docs/document.yaml
42
+ ```
43
+
44
+ ## Changelog
45
+
46
+ ### 0.1.1 - Unreleased
47
+
48
+ - Renamed the package and command to chaptr.
49
+ - Added publishing to PyPI through GitHub Actions Trusted Publishing.
50
+
51
+ ### 0.1.0
52
+
53
+ - Project initialization with the app's documentation and overwrite protection.
54
+ - Ordered Markdown chapters and simple shared variables.
55
+ - Automatic table captions, linked footnotes and a table of contents.
56
+ - Optional title pages, covers and author sections.
57
+ - Pre-designed PDF covers with page-size validation and preserved contents links.
58
+ - Markdown and HTML output, with an optional WeasyPrint PDF renderer.
59
+ - Bundled themes, project-local overrides and additional stylesheets.
60
+ - Command help and a bundled usage manual.
61
+
62
+ PDF requires native libraries.
63
+
64
+ Planned: [named document templates](docs/07-roadmap.md), including roleplaying
65
+ scenarios and workplace accessibility documents. Template selection is not available yet.
chaptr-0.1.1/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # chaptr
2
+
3
+ Turn separate Markdown chapters into one document, with shared variables and
4
+ editable themes. Produce merged Markdown, styled HTML or PDF.
5
+
6
+ ## Usage
7
+
8
+ chaptr runs in your terminal. Install it once and use it across document projects.
9
+ See [installation instructions](docs/01-requirements.md#installation) for the
10
+ source checkout and GitHub release wheel options.
11
+
12
+ | Command | Purpose |
13
+ | --- | --- |
14
+ | `chaptr init [directory]` | Create an editable copy of the app's documentation |
15
+ | `chaptr build` | Build the current project; HTML is the default |
16
+ | `chaptr build --format pdf` | Generate PDF when renderer dependencies are available |
17
+ | `chaptr help` | Read the bundled command manual |
18
+ | `chaptr --help` | List commands; each command also supports `--help` |
19
+
20
+ See the [documentation](docs/README.md) for requirements, the user workflow,
21
+ configuration, themes and current limitations. The documentation is itself an
22
+ chaptr project, so you can try the tool on its own source:
23
+
24
+ ```sh
25
+ chaptr build --config docs/document.yaml
26
+ ```
27
+
28
+ ## Changelog
29
+
30
+ ### 0.1.1 - Unreleased
31
+
32
+ - Renamed the package and command to chaptr.
33
+ - Added publishing to PyPI through GitHub Actions Trusted Publishing.
34
+
35
+ ### 0.1.0
36
+
37
+ - Project initialization with the app's documentation and overwrite protection.
38
+ - Ordered Markdown chapters and simple shared variables.
39
+ - Automatic table captions, linked footnotes and a table of contents.
40
+ - Optional title pages, covers and author sections.
41
+ - Pre-designed PDF covers with page-size validation and preserved contents links.
42
+ - Markdown and HTML output, with an optional WeasyPrint PDF renderer.
43
+ - Bundled themes, project-local overrides and additional stylesheets.
44
+ - Command help and a bundled usage manual.
45
+
46
+ PDF requires native libraries.
47
+
48
+ Planned: [named document templates](docs/07-roadmap.md), including roleplaying
49
+ scenarios and workplace accessibility documents. Template selection is not available yet.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: chaptr
3
+ Version: 0.1.1
4
+ Summary: Build independent Markdown document projects with shared variables and CSS themes.
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: markdown-it-py<5,>=3
8
+ Requires-Dist: mdit-py-plugins<1,>=0.5
9
+ Requires-Dist: PyYAML<7,>=6
10
+ Provides-Extra: pdf
11
+ Requires-Dist: WeasyPrint<70,>=68; extra == "pdf"
12
+ Requires-Dist: pypdf<7,>=6; extra == "pdf"
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest<10,>=8; extra == "dev"
15
+ Requires-Dist: pypdf<7,>=6; extra == "dev"
16
+
17
+ # chaptr
18
+
19
+ Turn separate Markdown chapters into one document, with shared variables and
20
+ editable themes. Produce merged Markdown, styled HTML or PDF.
21
+
22
+ ## Usage
23
+
24
+ chaptr runs in your terminal. Install it once and use it across document projects.
25
+ See [installation instructions](docs/01-requirements.md#installation) for the
26
+ source checkout and GitHub release wheel options.
27
+
28
+ | Command | Purpose |
29
+ | --- | --- |
30
+ | `chaptr init [directory]` | Create an editable copy of the app's documentation |
31
+ | `chaptr build` | Build the current project; HTML is the default |
32
+ | `chaptr build --format pdf` | Generate PDF when renderer dependencies are available |
33
+ | `chaptr help` | Read the bundled command manual |
34
+ | `chaptr --help` | List commands; each command also supports `--help` |
35
+
36
+ See the [documentation](docs/README.md) for requirements, the user workflow,
37
+ configuration, themes and current limitations. The documentation is itself an
38
+ chaptr project, so you can try the tool on its own source:
39
+
40
+ ```sh
41
+ chaptr build --config docs/document.yaml
42
+ ```
43
+
44
+ ## Changelog
45
+
46
+ ### 0.1.1 - Unreleased
47
+
48
+ - Renamed the package and command to chaptr.
49
+ - Added publishing to PyPI through GitHub Actions Trusted Publishing.
50
+
51
+ ### 0.1.0
52
+
53
+ - Project initialization with the app's documentation and overwrite protection.
54
+ - Ordered Markdown chapters and simple shared variables.
55
+ - Automatic table captions, linked footnotes and a table of contents.
56
+ - Optional title pages, covers and author sections.
57
+ - Pre-designed PDF covers with page-size validation and preserved contents links.
58
+ - Markdown and HTML output, with an optional WeasyPrint PDF renderer.
59
+ - Bundled themes, project-local overrides and additional stylesheets.
60
+ - Command help and a bundled usage manual.
61
+
62
+ PDF requires native libraries.
63
+
64
+ Planned: [named document templates](docs/07-roadmap.md), including roleplaying
65
+ scenarios and workplace accessibility documents. Template selection is not available yet.
@@ -0,0 +1,31 @@
1
+ README.md
2
+ pyproject.toml
3
+ chaptr.egg-info/PKG-INFO
4
+ chaptr.egg-info/SOURCES.txt
5
+ chaptr.egg-info/dependency_links.txt
6
+ chaptr.egg-info/entry_points.txt
7
+ chaptr.egg-info/requires.txt
8
+ chaptr.egg-info/top_level.txt
9
+ docs/00-authors.md
10
+ docs/00-front-cover.md
11
+ docs/01-requirements.md
12
+ docs/02-workflow.md
13
+ docs/03-configuration.md
14
+ docs/04-themes.md
15
+ docs/05-pdf.md
16
+ docs/06-limitations.md
17
+ docs/07-roadmap.md
18
+ docs/99-back-cover.md
19
+ docs/README.md
20
+ docs/document.yaml
21
+ docs/styles.css
22
+ src/chaptr/__init__.py
23
+ src/chaptr/cli.py
24
+ src/chaptr/manual.txt
25
+ src/chaptr/pdf.py
26
+ src/chaptr/render.py
27
+ src/chaptr/themes/base.css
28
+ src/chaptr/themes/modern.css
29
+ src/chaptr/themes/vintage.css
30
+ tests/test_build.py
31
+ tests/test_pdf.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ chaptr = chaptr.cli:main
@@ -0,0 +1,11 @@
1
+ markdown-it-py<5,>=3
2
+ mdit-py-plugins<1,>=0.5
3
+ PyYAML<7,>=6
4
+
5
+ [dev]
6
+ pytest<10,>=8
7
+ pypdf<7,>=6
8
+
9
+ [pdf]
10
+ WeasyPrint<70,>=68
11
+ pypdf<7,>=6
@@ -0,0 +1,2 @@
1
+ chaptr
2
+ chaptr_docs
@@ -0,0 +1,5 @@
1
+ # Authors
2
+
3
+ $app_name is maintained by its contributors.
4
+
5
+ This document describes version $app_version.
@@ -0,0 +1,5 @@
1
+ # $app_name
2
+
3
+ Documentation
4
+
5
+ Version $app_version
@@ -0,0 +1,71 @@
1
+ # Requirements
2
+
3
+ ## Runtime
4
+
5
+ - Python 3.11 or newer.
6
+ - The chaptr package, installed in a Python environment accessible from your terminal.
7
+ - `markdown-it-py`, `mdit-py-plugins` and `PyYAML`, installed automatically with chaptr.
8
+ - Windows, macOS or Linux. Document source files use UTF-8.
9
+
10
+ The installed command must be available on `PATH` or called by its full path.
11
+ If installed in a virtual environment, activate it or call its executable directly.
12
+ One installation can serve multiple document projects.
13
+
14
+ ## Installation
15
+
16
+ To install from PyPI, or upgrade an existing installation, run:
17
+
18
+ ```sh
19
+ python -m pip install --upgrade chaptr
20
+ ```
21
+
22
+ To install a wheel from a GitHub release, download `chaptr-0.1.1-py3-none-any.whl`
23
+ and run this command from the directory containing the downloaded file:
24
+
25
+ ```sh
26
+ python -m pip install ./chaptr-0.1.1-py3-none-any.whl
27
+ ```
28
+
29
+ To install from a source checkout, run this from the repository root:
30
+
31
+ ```sh
32
+ python -m pip install .
33
+ ```
34
+
35
+ To build a wheel from the source checkout, install the build tool and run:
36
+
37
+ ```sh
38
+ python -m pip install build
39
+ python -m build --wheel
40
+ ```
41
+
42
+ The wheel is written to `dist/` and can be attached to a GitHub release.
43
+
44
+ ## PyPI Publishing
45
+
46
+ The `.github/workflows/publish.yml` workflow builds and publishes the package
47
+ when a GitHub Release is published. Configure a Trusted Publisher for project
48
+ `chaptr` on PyPI with the repository owner and name, workflow filename
49
+ `publish.yml` and environment `pypi`. Create the `pypi` environment under the
50
+ GitHub repository's Settings > Environments. The current repository is
51
+ `clkjunk/mdoc`; update the PyPI publisher if you rename it.
52
+
53
+ A pending publisher does not reserve the `chaptr` name. The first successful
54
+ upload creates the PyPI project, so publish when the release is ready.
55
+
56
+ ## PDF Dependencies
57
+
58
+ PDF additionally requires WeasyPrint and native libraries, including Pango.
59
+ PDF cover assembly uses pypdf, included in the `pdf` extra.
60
+ HTML, Markdown, initialization and help do not require those components.
61
+ Platform-specific requirements are described in the PDF Rendering section.
62
+
63
+ ## Development
64
+
65
+ - `setuptools` is the package build backend.
66
+ - The `dev` extra supplies `pytest` and `pypdf` for the test suite.
67
+ - Development uses an editable installation: `python -m pip install -e ".[dev]"`.
68
+ - Run tests with `python -m pytest -q`.
69
+ - The `pdf` extra supplies WeasyPrint and pypdf but does not install native libraries.
70
+
71
+ A standalone executable and installer are not available; install chaptr with pip.
@@ -0,0 +1,69 @@
1
+ # User Workflow
2
+
3
+ Use $app_name $app_version to create a document, edit its source files and rebuild
4
+ whenever the content changes.
5
+
6
+ ## Create a Project
7
+
8
+ ```sh
9
+ chaptr init my-document
10
+ cd my-document
11
+ ```
12
+
13
+ Or run `chaptr init` inside the directory you want to use. Initialization is
14
+ noninteractive. Its default content is $app_name's own documentation: the section
15
+ files, `README.md`, `document.yaml` and `styles.css`, plus a `.gitignore` that
16
+ excludes generated build output. The files come bundled with the CLI.
17
+
18
+ Open `README.md` to read the documentation or run `chaptr build` to render it.
19
+ Replace the sections with your own content when ready.
20
+
21
+ Existing starter files are never overwritten. Conflicts stop initialization
22
+ before files are written; unrelated files are kept. There is no force option.
23
+
24
+ ## Edit the Content
25
+
26
+ 1. Set shared values in the configuration's `variables` mapping.
27
+ 2. Edit the Markdown chapters with any text editor.
28
+ 3. Add new chapter paths to `files` in the order they should appear.
29
+ 4. Select a theme or adjust the project stylesheet when needed.
30
+
31
+ Rename or replace the documentation sections and update `files` accordingly.
32
+ Named project templates are future work; `init` currently has one default only.
33
+
34
+ ## Build
35
+
36
+ ```sh
37
+ chaptr build
38
+ chaptr build --format markdown
39
+ chaptr build --format pdf
40
+ ```
41
+
42
+ The default format is HTML. PDF needs the additional renderer dependencies.
43
+ The output directory is created on the first build and receives `document.html`,
44
+ `document.md` or `document.pdf`. Rebuilding a format replaces its previous file;
45
+ other formats are untouched. Successful builds print the output path.
46
+
47
+ Open HTML directly in a browser.
48
+
49
+ ## Work from Another Directory
50
+
51
+ ```sh
52
+ chaptr build --config "path/to/my-document/document.yaml"
53
+ ```
54
+
55
+ Without `--config`, chaptr uses `document.yaml` in the current directory.
56
+ All configured paths are resolved relative to that YAML file. Quote paths
57
+ containing spaces.
58
+
59
+ ## Get Help
60
+
61
+ ```sh
62
+ chaptr --help
63
+ chaptr init --help
64
+ chaptr build --help
65
+ chaptr help
66
+ ```
67
+
68
+ Exit codes are `0` for success, `1` for initialization or build errors and `2`
69
+ for invalid command-line usage. Help works without a document project.
@@ -0,0 +1,133 @@
1
+ # Configuration and Variables
2
+
3
+ Each document project has a YAML configuration. Only `files` is required.[^paths]
4
+
5
+ ```yaml
6
+ title: Product Guide
7
+ theme: modern
8
+ stylesheet: styles.css
9
+ output: build
10
+ files:
11
+ - chapters/01-introduction.md
12
+ - chapters/02-requirements.md
13
+ variables:
14
+ product_name: Field Notes
15
+ version: "1.0"
16
+ ```
17
+
18
+ ## Fields
19
+
20
+ Table: Configuration fields
21
+
22
+ | Field | Meaning | Default |
23
+ | --- | --- | --- |
24
+ | `files` | Nonempty list of Markdown paths, in chapter order | Required |
25
+ | `title` | HTML document title | Document |
26
+ | `theme` | Named CSS theme for HTML and PDF | modern |
27
+ | `stylesheet` | Extra project CSS applied after the theme | None |
28
+ | `output` | Directory for generated files | build |
29
+ | `variables` | Shared text, numeric or boolean values | Empty mapping |
30
+ | `title_page` | Generate a title page using title, subtitle and author | false |
31
+ | `subtitle` | Subtitle on the generated title page | Empty |
32
+ | `author` | Author text on the generated title page | Empty |
33
+ | `front_cover` | Markdown or single-page PDF front cover | None |
34
+ | `author_section` | Markdown file for author details | None |
35
+ | `table_of_contents` | Generate linked contents with PDF page numbers | false |
36
+ | `toc_depth` | Heading levels included in contents, from 1 to 6 | 2 |
37
+ | `back_cover` | Markdown or single-page PDF back cover | None |
38
+
39
+ Configured paths are relative to the configuration file. To use a different
40
+ configuration filename, pass its path with `--config`.
41
+
42
+ ## Variables
43
+
44
+ Reference a shared value using `$product_name`:
45
+
46
+ ```markdown
47
+ # $product_name
48
+
49
+ Product guide, version $version.
50
+ ```
51
+
52
+ Names contain letters, digits or underscores and cannot begin with a digit.
53
+ Undefined names stop the build with a source filename and line number.
54
+ Values are inserted as Markdown, so they may affect the rendered formatting.
55
+
56
+ Write `$$` for a literal dollar sign: `$$20` becomes `$20` in ordinary text.
57
+ Code blocks and ordinary inline code retain their original contents.
58
+ Multiline inline code is a current exception.
59
+
60
+ Only variable substitution is supported.
61
+
62
+ ## Table Captions
63
+
64
+ Place a standalone `Table: Caption text` paragraph directly above or below a table:
65
+
66
+ ```markdown
67
+ Table: Release formats
68
+
69
+ | Format | Extension |
70
+ | --- | --- |
71
+ | HTML | .html |
72
+ | PDF | .pdf |
73
+ ```
74
+
75
+ Captions become `Table 1. Release formats`, numbered across the document in chapter
76
+ order. Moving or inserting captioned tables updates their numbers. Tables without
77
+ captions stay unnumbered. Use one caption per table. Caption text supports inline
78
+ Markdown. A caption below the source table is displayed below it.
79
+
80
+ ## Footnotes
81
+
82
+ Use Markdown footnote references and definitions:
83
+
84
+ ```markdown
85
+ An explanation with a note.[^detail]
86
+
87
+ [^detail]: Additional information with **formatting**.
88
+ ```
89
+
90
+ Notes are numbered by first reference across the document and collected in a
91
+ linked Notes section before the back cover. References and definitions can be in
92
+ different chapters; use unique labels throughout the project. Notes currently
93
+ appear at the end of the document, not at the bottom of individual PDF pages.
94
+
95
+ ## Document Pages
96
+
97
+ ```yaml
98
+ title: Product Guide
99
+ subtitle: Release documentation
100
+ author: Example Author
101
+ title_page: true
102
+ front_cover: front-cover.md
103
+ author_section: authors.md
104
+ table_of_contents: true
105
+ toc_depth: 2
106
+ back_cover: back-cover.md
107
+ ```
108
+
109
+ All these options are optional. Page order is front cover, title page, author
110
+ section, contents, chapters, notes and back cover. Markdown covers and author files
111
+ support variables and images. Do not list them again in `files`. The title,
112
+ subtitle and author fields are plain text.
113
+
114
+ For externally designed covers:
115
+
116
+ ```yaml
117
+ front_cover: covers/front.pdf
118
+ back_cover: covers/back.pdf
119
+ ```
120
+
121
+ PDF covers must be unencrypted single-page files matching the generated page size.
122
+ They are attached unchanged to the final PDF. HTML and Markdown builds omit them.
123
+ See [PDF Rendering](05-pdf.md) for validation and page-numbering details.
124
+
125
+ Contents include chapter headings up to `toc_depth`. Duplicate heading names get
126
+ unique IDs such as `requirements` and `requirements-2`. HTML contents use links;
127
+ PDF contents also show page numbers.
128
+
129
+ HTML and PDF generate title pages, contents and numbered captions. Merged Markdown
130
+ includes Markdown cover and author sections and preserves caption and footnote
131
+ syntax. It does not generate title-page or contents markup.
132
+
133
+ [^paths]: Source and output paths are resolved relative to the configuration file.
@@ -0,0 +1,94 @@
1
+ # Themes
2
+
3
+ Themes are editable CSS. The application bundles `modern` and `vintage`; document
4
+ projects can replace either theme or define a new name without modifying the app.
5
+
6
+ ## Choose a Theme
7
+
8
+ Set `theme: vintage` in the configuration or override it for one build:
9
+
10
+ ```sh
11
+ chaptr build --theme vintage
12
+ ```
13
+
14
+ Theme selection applies to HTML and PDF.
15
+
16
+ ## Customize
17
+
18
+ For small adjustments, create a project stylesheet and configure
19
+ `stylesheet: styles.css`:
20
+
21
+ ```css
22
+ body { font-family: Georgia, serif; line-height: 1.75; }
23
+ th { background: #edf4f0; }
24
+ @page { size: A4; margin: 25mm; }
25
+ ```
26
+
27
+ For a complete theme, create `themes/company.css` and configure `theme: company`.
28
+ A local `themes/modern.css` replaces the bundled modern theme only for that
29
+ project. Default themes remain part of the installed application.
30
+
31
+ Styling is applied in this order:
32
+
33
+ 1. Shared application base CSS.
34
+ 2. The project-local named theme or the bundled theme if no local replacement exists.
35
+ 3. The optional configured stylesheet.
36
+
37
+ ## Print Styling
38
+
39
+ The base print layout uses A4 pages, 20mm margins and a page break between chapters.
40
+ Use `@page` to adjust page size and margins and `@media print` for print-only rules.
41
+ Fonts must be available on the rendering machine or supplied as local font assets.
42
+
43
+ HTML and PDF share CSS, but browser and WeasyPrint support differ. Keep print CSS
44
+ conservative and verify the actual PDF. Relative CSS asset URLs currently resolve
45
+ from the document project's root.
46
+
47
+ ## Document Elements
48
+
49
+ Use `caption` to style table labels. Their top or bottom placement follows the
50
+ caption's source position. `.front-cover`, `.title-page`, `.author-section`,
51
+ `.contents` and `.back-cover` style the optional document pages.
52
+
53
+ ```css
54
+ caption { color: #24634b; font-size: 10pt; }
55
+ .title-page { text-align: center; }
56
+ .footnotes { font-size: 9pt; }
57
+ ```
58
+
59
+ The base print theme starts each optional page separately. Contents page numbers
60
+ use WeasyPrint's `target-counter` support. Custom themes can override these rules.
61
+ External PDF covers keep their own styling; theme rules apply to generated pages.
62
+
63
+ ## Editable Stat Blocks
64
+
65
+ Wrap ordinary Markdown in `::: monster` and a closing `:::` to render a
66
+ single-column stat block. Use an H2 for its name, an italic paragraph for its
67
+ description, a table for attributes and H3 headings for any ability sections.
68
+ Section names and statistics are not tied to a particular game system.
69
+
70
+ ```markdown
71
+ ::: monster
72
+ ## Example Creature
73
+ *Medium humanoid*
74
+
75
+ **AC:** 12
76
+ **HP:** 40
77
+
78
+ | STR | DEX | CON |
79
+ | --- | --- | --- |
80
+ | 9 (-1) | 14 (+2) | 11 (+0) |
81
+
82
+ ### Actions
83
+ **Strike.** Write the complete action here.
84
+ :::
85
+ ```
86
+
87
+ Include only the sections needed, such as actions, spells or reactions. Leave a
88
+ blank line between paragraphs; two trailing spaces create a line break within
89
+ a paragraph. The block's headings receive link targets but do not enter the
90
+ document table of contents. Keep the closing delimiter in the same chapter.
91
+
92
+ Style `.monster-card` in the project stylesheet. Override `--monster-accent`
93
+ and `--monster-rule` on that selector to change its colors. HTML and PDF render
94
+ the block; Markdown output preserves the source syntax. Raw HTML remains disabled.
@@ -0,0 +1,70 @@
1
+ # PDF Rendering
2
+
3
+ chaptr renders the configured Markdown to HTML, applies CSS and passes that document
4
+ to WeasyPrint for PDF generation.
5
+
6
+ ```sh
7
+ chaptr build --format pdf
8
+ ```
9
+
10
+ ## Requirements
11
+
12
+ The optional `pdf` extra supplies WeasyPrint and pypdf. For development in the application
13
+ repository, install it with `python -m pip install -e ".[pdf]"`.
14
+ For a wheel installation, request its extra:
15
+
16
+ ```sh
17
+ python -m pip install "path/to/chaptr-0.1.1-py3-none-any.whl[pdf]"
18
+ ```
19
+
20
+ WeasyPrint also needs native system libraries, including Pango. These are compiled
21
+ components for font handling and text layout.
22
+ Installing the Python extra alone may not be sufficient.
23
+
24
+ Follow the current [WeasyPrint platform requirements](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation)
25
+ for Windows, macOS or Linux.
26
+
27
+ ## PDF Covers
28
+
29
+ Export a single-page PDF for each cover from your design tool, then configure:
30
+
31
+ ```yaml
32
+ front_cover: covers/front.pdf
33
+ back_cover: covers/back.pdf
34
+ ```
35
+
36
+ Either cover is optional. Paths are relative to the project configuration.
37
+ Build with `chaptr build --format pdf` to combine the front cover, generated content
38
+ and back cover into one PDF. A cover can also be Markdown; mixed types work.
39
+
40
+ PDF covers retain their artwork, fonts and page content. Generated content margins
41
+ and theme CSS do not add borders to them. Export the design to the page edges for
42
+ an edge-to-edge cover. Covers are not scaled or cropped during assembly.
43
+
44
+ Each PDF cover must be unencrypted and contain exactly one page. Its page size
45
+ must match the adjacent generated page, allowing a rounding difference of one
46
+ PDF point. An A4 document needs A4 covers; a landscape cover needs matching
47
+ document orientation. Invalid covers fail the build before existing output is
48
+ replaced. Source cover files cannot also be the output document.
49
+
50
+ The final PDF keeps the generated document's title metadata, bookmarks and linked
51
+ destinations. An inserted front cover counts as page 1, so contents page numbers
52
+ match the final PDF's physical pages. Avoid overriding the PDF page counter in
53
+ custom themes when using this numbering scheme.
54
+
55
+ HTML and Markdown builds omit PDF covers. They can still be used to preview and
56
+ edit the content. The docs project keeps Markdown covers as its editable default.
57
+ Print-production bleed and trim configuration are not provided.
58
+
59
+ ## Current Status
60
+
61
+ PDF generation has been checked on the Windows development setup, including
62
+ document pages, captions, notes, PDF covers and contents page numbers. A clean-machine
63
+ installation has not yet been verified.
64
+
65
+ Missing renderer dependencies produce a build error. HTML and Markdown output,
66
+ initialization and help remain available without them.
67
+
68
+ Self-contained releases are planned to bundle Python, WeasyPrint and native
69
+ libraries so users do not need separate setup. Those bundles are not implemented
70
+ or verified yet. The current wheel requires Python.