md-condition
This is an extension to Python-Markdown which allows conditional compilations to be inserted into the text.
Install
This module can now be installed using pip.
$ pip install md-condition
Usage
The syntax for use within your Markdown files is
<!--- #if DEBUG -->
# md-condition DEBUG
<!--- #else -->
not DEBUG
<!--- #endif -->
<!--- #if RELEASE -->
# md-condition RELEASE
<!--- #else -->
not RELEASE
<!--- #endif -->
<h1>md-condition DEBUG</h1>
<p>not RELEASE</p>
Rules
symboldefines one or more symbols:DEBUG,DEBUG RELEASE,DEBUG|RELEASE, or a list[DEBUG, RELEASE]. With nosymbolconfigured, every#ifis false.<!--- #if A B -->is true when any defined symbol is exactly one of the listed names (DEBUGdoes not matchDEBUG_X). Names are separated by spaces and/or|, so#if A | Band#if A|Bmean the same.#elseis optional; nested#ifblocks are not supported.- Malformed blocks (unclosed
#if, stray#else/#endif, duplicate#else, nesting) raisemd_condition.ConditionSyntaxErrorwith the offending line number and text. - Inside fenced code blocks (
```/~~~), complete#if…#endifblocks still apply (conditional code samples), but malformed directives are left as text, so docs can show md-condition syntax without breaking the build.
MkDocs Integration
In your mkdocs.yml add this to markdown_extensions.
markdown_extensions:
- md_condition:
symbol: DEBUG
To define several symbols at once:
markdown_extensions:
- md_condition:
symbol: [DEBUG, RELEASE]
Metadata
Release files for md-condition 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| md_condition-0.2.0.tar.gz | 8.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| md_condition-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / md_condition-0.2.0.tar.gz
| Download URL | md_condition-0.2.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
662a85a8174dd8c47678b0d91cd08803ff5faeca0c9665fa9939f183a8b46c4c
|
|
BLAKE2b-256 checksum How to use checksums |
94083fbfed9a54189ee9861f439180111a30a343cdeccebd2076e09f575a83aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logRelease files / md_condition-0.2.0-py3-none-any.whl
| Download URL | md_condition-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
989739bcf422825a63bb2e4f9054fa4a196ca33329d27a9bd7a489b64a4866cf
|
|
BLAKE2b-256 checksum How to use checksums |
b4b03a1da550bf7ac40da8d7b08e04246dbb183d2bd48be5677e764d0cbb9a6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logSecurity for md-condition 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for md_condition-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.