Skip to main content

prodockit

A family of extensions for Zensical needed for professional and academic documentation: section cross-references, bibliography/citation handling, a glossary, and a Pandoc/WeasyPrint PDF pipeline for the downloadable, submittable document these usually need alongside the website itself.

Most of prodockit is Python-Markdown extensions, enabled in zensical.toml. prodockit.pdf is a command-line tool instead (prodockit pdf), since a PDF build pipeline isn't a Markdown syntax extension - it reads the same zensical.toml too. In addition, there's a set of website macros (prodockit.zensical_macros) to help use prodockit's features.

It's a kit for professional documentation, built on Zensical's own Markdown and Pandoc/WeasyPrint PDF pipeline.

Status: early, but functional - prodockit.headings, prodockit.refs, prodockit.citations, prodockit.glossary, prodockit.tables, prodockit.bibliography, prodockit.index, prodockit.pdf, prodockit.sync_repo, prodockit.pins and prodockit.zensical_macros are implemented and tested. prodockit.bootstrap is newer: exercised end to end on macOS against the University of Surrey's GitLab, with Ubuntu and Windows written but not yet run on a real machine.

Full documentation

Installation

Requires Python 3.10 or later (tested on 3.10-3.13).

pip install prodockit

Check what you have with prodockit --version, which prints the bare number the same way zensical --version does.

prodockit.pdf and prodockit.bibliography additionally need pandoc, and the PDF build needs weasyprint - external binaries, not Python packages, so pip doesn't install them. See Installation for the full list, including the optional Node tooling for Mermaid diagrams and TeX maths in the PDF.

Extensions

Extension Description
prodockit.headings Gives every heading an id and a hierarchical section number ("1", "1.1", "1.2", "2", ...).
prodockit.refs \ref{id} section cross-references, resolving to the target's current number and name - and \autoref{id}, which additionally carries the target's page number in the PDF.
prodockit.citations Define a source once, cite it by key anywhere with \citeref{id} - auto-generates the bracketed, linked citation text.
prodockit.glossary Define a term once (an acronym expansion, a glossary entry), insert it by id anywhere with \gls{id} - similar in spirit to LaTeX's glossaries package.
prodockit.tables Percentage or fixed column widths on a table, via a width attribute already attachable to a header cell with attr_list.
prodockit.bibliography An alternative to prodockit.citations: define sources in a BibTeX/BibLaTeX .bib file and format \cite{id}/the reference list in any Citation Style Language style, via Pandoc's own --citeproc.
prodockit.index Mark a term inline with \index{Term} for a traditional, PDF-only back-of-book index - with hierarchical sub-entries and code-styled terms.
import markdown

html = markdown.markdown(
    text,
    extensions=[
        "attr_list", "prodockit.headings", "prodockit.refs", "prodockit.citations", "prodockit.glossary"
    ],
)
# Introduction {: #intro }

See \ref{intro} for background.\citeref{skou2023} This uses \gls{css}.

Skoulikari, A. (2023) *Learning Git*.
{: #skou2023 data-cite-text="Skoulikari, 2023" }

**CSS** - Cascading Style Sheets.
{: #css data-term="CSS" }

\ref{intro} resolves to a link reading 1 Introduction - the heading's number and name, with \autoref{intro} additionally carrying its page number in the PDF; \citeref{skou2023} resolves to [Skoulikari, 2023], linked to that source; \gls{css} resolves to CSS, linked to its own definition. All three stay correct if content is reordered, since resolution happens fresh on every conversion. See the docs for options, multi-page registry sharing, and full syntax details.

PDF generation

prodockit.pdf builds a standalone PDF from your site, via Pandoc and WeasyPrint (both need to be installed separately - see the docs). No Python required - it reads the same zensical.toml your site already has:

prodockit pdf

That's it - run it from your project root and it builds a complete PDF, table of contents included, from every page in your nav. Also handles a table too wide for a portrait page - printed sideways, on its own landscape page(s), spanning multiple pages with a repeated heading row - {.web-only}/{.pdf-only} markers for content that should only appear in one of the two outputs, and a two-column, letter-headed back-of-book index (pdf_include_index) generated from prodockit.index's own \index{Term} markers. See the docs for the zensical.toml settings it reads, and for the Python API (build_pdf(), prodockit.pdf.html/.lua/.css/.icons/.mermaid/.rotate) if you're scripting your own build pipeline instead.

prodockit source-bundle builds a second, separate PDF - your Markdown content and zensical.toml, one file per page, into docs_dir - for a submission that needs the underlying source alongside the document itself:

prodockit source-bundle

A separate command from prodockit pdf, so a project that wants only one of the two PDFs doesn't build the other on every run.

Machine setup

prodockit bootstrap turns the User Guide's install sequence into eighteen stages that can each be checked and repaired individually - editor, git, SSH, clone, remote, commit identity, pandoc, Node - rather than a long list followed top to bottom and hoped over:

prodockit bootstrap            # report what is set up; changes nothing
prodockit bootstrap --dry-run  # print the exact commands it would run
prodockit bootstrap --apply    # set up what needs it, asking first

It cannot be the first thing you run - it is a prodockit command, so Python and pip install prodockit come first. Two steps need a human at a browser (uploading an SSH key, creating your own project); those are guided and then verified, rather than automated with a token. Currently implements the University of Surrey's GitLab only.

Website macros

prodockit.zensical_macros provides a site-wide word count, the git-detected repository URL, the latest release tag, chapter/appendix numbering that continues across pages, and reference/acronym/glossary spacing that matches prodockit.pdf's own PDF output - as Jinja variables/macros for Zensical's own macros plugin:

[project.markdown_extensions.zensical.extensions.macros]
modules = ["prodockit.zensical_macros"]

See the docs for the full variable/macro list.

Repository metadata

prodockit sync-repo keeps repo_url, repo_name, the header brand icon, edit_uri, site_url and your README's badge row matching the git remote your checkout actually uses - so forking or mirroring a project between GitHub, GitLab and Bitbucket doesn't leave stale links, the wrong icon, or a canonical URL pointing at the old host behind:

prodockit sync-repo          # update everything from `origin`
prodockit sync-repo --check  # report drift and exit non-zero, for CI

It also sets edit_uri explicitly, which fixes the "edit this page" button on a self-hosted GitLab and stops it pointing at a master branch that may not exist.

Version pinning and drift

A documentation build has more inputs than its own source: zensical renders the site, weasyprint lays out the PDF, and the CI runner image carries pandoc, the fonts and Chrome. Left unpinned, an upgrade doesn't fail the build - it quietly publishes a different document.

Pinning them means declaring the same version in several files at once, which nothing keeps in step. prodockit pins finds every declaration and moves them together, keeping each one's own operator so a library floor stays a floor and a build pin stays exact:

prodockit pins               # prompt per package; Enter takes the newest
prodockit pins --check       # behind PyPI, or files disagreeing? exit non-zero
prodockit pins -p ubuntu     # runner images and container tags too

Pandoc is managed by default too - not a pip package, so it's matched as a PANDOC_VERSION CI variable rather than a specifier.

It reads pyproject.toml, GitHub Actions workflows, .gitlab-ci.yml and requirements/constraints files, so the same command works on either host. The docs also carry a weekly drift job for GitHub Actions and GitLab CI that rebuilds with the newest versions, diffs the output byte for byte, and opens an issue when an upgrade would change what you publish.

Development

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest

zensical is a core dependency, so zensical serve is available as soon as prodockit is installed - no extra step needed to build the documentation locally.

Contributing

Contributions are welcome - see CONTRIBUTING.md.

License

MIT - see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prodockit-0.26.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prodockit-0.26.0-py3-none-any.whl (215.7 kB view details)

Uploaded Python 3

File details

Details for the file prodockit-0.26.0.tar.gz.

File metadata

  • Download URL: prodockit-0.26.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for prodockit-0.26.0.tar.gz
Algorithm Hash digest
SHA256 e9aa297b6fa3285eaf9bca0bf561d45d4cf2b6157db0c30f01678a4ec906bc5a
MD5 51f810666a28fb5b5d2a8dd9a49d5ff7
BLAKE2b-256 cd0f3d7e4456b66dbc28edd3800a72a186c91be1902935d965a84b06e3784ba4

See more details on using hashes here.

Provenance

The following attestation bundles were made for prodockit-0.26.0.tar.gz:

Publisher: publish.yml on buckwem/prodockit-extensions

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prodockit-0.26.0-py3-none-any.whl.

File metadata

  • Download URL: prodockit-0.26.0-py3-none-any.whl
  • Upload date:
  • Size: 215.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for prodockit-0.26.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89e67bf89dc24b3d9c6bce93d7b7cf621cffd38a652afd3940272b16b876fe39
MD5 7c7ae6179ab39338160401c4b96f08d9
BLAKE2b-256 12a19b911f9d5d085fd3c09e018bcf2d22a4d8dc09a090e995736141593f7283

See more details on using hashes here.

Provenance

The following attestation bundles were made for prodockit-0.26.0-py3-none-any.whl:

Publisher: publish.yml on buckwem/prodockit-extensions

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.63.0

2 files

0.62.0

2 files

0.61.6

2 files

0.61.5

2 files

0.61.3

2 files

0.61.2

2 files

0.61.1

2 files

0.61.0

2 files

0.60.4

2 files

0.60.3

2 files

0.60.2

2 files

0.60.1

2 files

0.60.0

2 files

0.59.0

2 files

0.58.0

2 files

0.57.0

2 files

0.56.0

2 files

0.55.0

2 files

0.54.1

2 files

0.54.0

2 files

0.53.0

2 files

0.52.0

2 files

0.51.4

2 files

0.51.3

2 files

0.51.2

2 files

0.51.1

2 files

0.51.0

2 files

0.50.1

2 files

0.50.0

2 files

0.49.1

2 files

0.49.0

2 files

0.48.1

2 files

0.48.0

2 files

0.47.0

2 files

0.46.0

2 files

0.45.0

2 files

0.44.0

2 files

0.43.2

2 files

0.43.1

2 files

0.43.0

2 files

0.42.1

2 files

0.42.0

2 files

0.41.0

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.4

2 files

0.36.3

2 files

0.36.2

2 files

0.36.1

2 files

0.36.0

2 files

0.35.1

2 files

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.1

2 files

0.32.0

2 files

0.31.1

2 files

0.31.0

2 files

0.30.1

2 files

0.30.0

2 files

0.29.0

2 files

0.28.1

2 files

0.28.0

2 files

0.27.0

2 files

0.26.7

2 files

0.26.6

2 files

0.26.5

2 files

0.26.4

2 files

0.26.3

2 files

0.26.2

2 files

0.26.1

2 files

This release

0.26.0 This release

2 files

0.25.0

2 files

0.24.1

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.1

2 files

0.20.0

2 files

0.19.1

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.5

2 files

0.17.4

2 files

0.17.3

2 files

0.17.2

2 files

0.17.1

2 files

0.17.0

2 files

0.16.0

2 files

0.15.2

2 files

0.15.1

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.9

2 files

0.10.8

2 files

0.10.7

2 files

0.10.6

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.8

2 files

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page