Skip to main content

A family of Python-Markdown extensions for section cross-references and bibliography/citation handling, built for use with Zensical

Project description

zendoc

A family of Python-Markdown extensions for section cross-references and bibliography/citation handling, in the spirit of pymdown-extensions: each extension is independent and enabled separately. Built for use with Zensical - configure it the same way as any other Zensical/pymdownx Markdown extension, via zensical.toml - but since it's a standard Python-Markdown extension, it works with any tool built on Python-Markdown (MkDocs, etc.). Factored out of zendoc-template, a Zensical project, so it can be installed and reused independently of that template.

Status: early, but functional - zendoc.headings, zendoc.refs, and zendoc.citations are implemented and tested. See zendoc-template#25 for the tracking issue and scope.

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.
import markdown

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

See \ref{intro} for background.\cite{skou2023}

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

\ref{intro} resolves to a link reading 1 - the heading's current section number - and \cite{skou2023} resolves to [Skoulikari, 2023], linked to that source. Both 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.

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.4.0.tar.gz (27.1 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.4.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for zendoc-0.4.0.tar.gz
Algorithm Hash digest
SHA256 082dbec3e132379ebd4d752c29b7cd955c11c433a62c770ed5ccac34720f2183
MD5 49a1e776ac49bfca3a0a98f642f144c0
BLAKE2b-256 0fcd04607a4c69cf9874dcd9f98972fdca3bcb8bad5b61965fac377532fefc4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for zendoc-0.4.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: zendoc-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f3cff1b15e6407cbe660d9d69e221fd1ff31097e6c1a2fceb47410e5e5d530b
MD5 ac52a3edf0bb974d60f294d43fcbe9d6
BLAKE2b-256 10dbdc26fc2913be37eb6f8a560ad60c4975a677c1502d0b87b720f39004509e

See more details on using hashes here.

Provenance

The following attestation bundles were made for zendoc-0.4.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