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,zendoc.citations, andzendoc.glossaryare implemented and tested. See zendoc-template#25 for the tracking issue and scope.
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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zendoc-0.5.0.tar.gz.
File metadata
- Download URL: zendoc-0.5.0.tar.gz
- Upload date:
- Size: 31.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
405653d39beeb0162b8252e8868f2bfafe0b776c69a5e40ef4b9b655b34e49db
|
|
| MD5 |
35731d3a1b4fb5325c48b05b62345f2d
|
|
| BLAKE2b-256 |
51eaf88bc1f9f35cc9c3e63b833a8ce2ef417ae2b7378cf8524cf7ac1df4b11a
|
Provenance
The following attestation bundles were made for zendoc-0.5.0.tar.gz:
Publisher:
publish.yml on buckwem/zendoc-extension
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zendoc-0.5.0.tar.gz -
Subject digest:
405653d39beeb0162b8252e8868f2bfafe0b776c69a5e40ef4b9b655b34e49db - Sigstore transparency entry: 2168353912
- Sigstore integration time:
-
Permalink:
buckwem/zendoc-extension@a44cabc9332f7f67eef82c03e73d7b469a5bb38e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/buckwem
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a44cabc9332f7f67eef82c03e73d7b469a5bb38e -
Trigger Event:
release
-
Statement type:
File details
Details for the file zendoc-0.5.0-py3-none-any.whl.
File metadata
- Download URL: zendoc-0.5.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18c431f13425c120ec6ed2566da78d27bde4bcc142c1ece25693a0417a70e5e5
|
|
| MD5 |
40f29e66b005bfa1df646f0ac74a4ce5
|
|
| BLAKE2b-256 |
6ffc2f0770d9a9f146a2d8b9c88023cf4fcba4d3f2d83dbc3327c5f68686b72d
|
Provenance
The following attestation bundles were made for zendoc-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on buckwem/zendoc-extension
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zendoc-0.5.0-py3-none-any.whl -
Subject digest:
18c431f13425c120ec6ed2566da78d27bde4bcc142c1ece25693a0417a70e5e5 - Sigstore transparency entry: 2168353926
- Sigstore integration time:
-
Permalink:
buckwem/zendoc-extension@a44cabc9332f7f67eef82c03e73d7b469a5bb38e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/buckwem
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a44cabc9332f7f67eef82c03e73d7b469a5bb38e -
Trigger Event:
release
-
Statement type: