Skip to main content

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

Project description

zendoc

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. Each piece is independent, so you only pay for what you use.

Most of zendoc is Python-Markdown extensions, in the spirit of pymdown-extensions - configure one the same way as any other Zensical/pymdownx Markdown extension, via zensical.toml. zendoc.pdf is a plain function library instead, since a PDF build pipeline isn't a Markdown syntax extension.

Status: early, but functional - zendoc.headings, zendoc.refs, zendoc.citations, zendoc.glossary, and zendoc.pdf are implemented and tested.

Full documentation

Installation

pip install zendoc

Extensions

Extension Description
zendoc.headings Gives every heading an id and a hierarchical section number ("1", "1.1", "1.2", "2", ...).
zendoc.refs \ref{id} section cross-references, resolving to the target's current number - similar in spirit to LaTeX's \ref.
zendoc.citations Define a source once, cite it by key anywhere with \cite{id} - auto-generates the bracketed, linked citation text.
zendoc.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.
import markdown

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

See \ref{intro} for background.\cite{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 - the heading's current section number; \cite{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

zendoc.pdf builds a standalone PDF from your site's own rendered pages, via Pandoc and WeasyPrint - not a Python-Markdown extension, a plain function library. build_pdf() is a one-call wrapper: hand it your rendered pages and where you want the PDF written.

from zendoc.pdf import Page, build_pdf

build_pdf(
    [Page(docs_rel_path="index.md", html=rendered_html, is_index=True)],
    "dist/report.pdf",
)

See the docs for the full parameter list, and for the individual pieces (zendoc.pdf.html/ .lua/.css/.icons/.mermaid) if you need more control over how they fit together.

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 zendoc is installed - no extra step needed to build the documentation locally.

License

MIT - see LICENSE.

Project details


Download files

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

Source Distribution

zendoc-0.8.0.tar.gz (76.9 kB view details)

Uploaded Source

Built Distribution

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

zendoc-0.8.0-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

Details for the file zendoc-0.8.0.tar.gz.

File metadata

  • Download URL: zendoc-0.8.0.tar.gz
  • Upload date:
  • Size: 76.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zendoc-0.8.0.tar.gz
Algorithm Hash digest
SHA256 881d43350a61189fb21fac310bf95688247ea7392ce22ae9d8af3bd4554c0812
MD5 510a65fc3d8b4d091abc817ae81b258d
BLAKE2b-256 7a5f65d96870781276838324c58ca01529c39c76945e2dbaf97ad502a0e7577d

See more details on using hashes here.

Provenance

The following attestation bundles were made for zendoc-0.8.0.tar.gz:

Publisher: publish.yml on buckwem/zendoc-extension

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

File details

Details for the file zendoc-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: zendoc-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 56.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zendoc-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c80a60458e9462133a032fc96f907fabedbc7c75b0aa5d855aaee29fe96c725
MD5 f304640adff1cc25a9e696043a5155e4
BLAKE2b-256 687d81c88b2903efe03db651de96ce6107aefbc586f0dae916784f2f058e71f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for zendoc-0.8.0-py3-none-any.whl:

Publisher: publish.yml on buckwem/zendoc-extension

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page