Python-Markdown extension for MultiMarkdown 6 table syntax
Project description
pymdown-multimd-table
A Python-Markdown extension implementing MultiMarkdown 6 extended table syntax,
mirroring the feature set of the markdown-it-multimd-table JavaScript plugin.
Features
Standard (always enabled)
| Feature | Syntax |
|---|---|
| Column spanning (colspan) | Empty cells || extend the previous cell |
| Text alignment | :---, :---:, ---: in the separator |
| Wrappable columns | ---+ in the separator adds class="extend" |
| Multiple header rows | Multiple rows before the separator |
| Table captions | [caption text] or [caption text][label] |
| Multiple tbody sections | Blank line between data rows (see multibody) |
| Inline Markdown | Bold, italic, code, etc. inside cells |
Optional (controlled by config)
| Option | Default | Description |
|---|---|---|
rowspan |
False |
^^ in a cell merges it with the cell above |
multiline |
False |
Backslash \ at end of row continues cell content on the next row |
headerless |
False |
Tables without a header/separator row |
multibody |
True |
Blank lines between data rows create separate <tbody> elements |
autolabel |
True |
Auto-generate id from caption text |
attr_list |
False |
Parse {.class #id key=val} attribute blocks on cells and rows |
Installation
pip install pymdown-multimd-table
Usage
import markdown
md = markdown.Markdown(extensions=["pymdown_multimd_table"])
html = md.convert(source)
With options:
md = markdown.Markdown(
extensions=["pymdown_multimd_table"],
extension_configs={
"pymdown_multimd_table": {
"rowspan": True,
"multiline": True,
"headerless": True,
"multibody": True, # default
"autolabel": True, # default
}
},
)
In MkDocs (mkdocs.yml):
markdown_extensions:
- pymdown_multimd_table:
rowspan: true
multiline: true
Syntax Examples
Basic table
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
| First Header | Second Header |
|---|---|
| Content Cell | Content Cell |
Alignment
| Item | Value |
| :-------: | -----: |
| Centered | Right |
| Item | Value |
|---|---|
| Centered | Right |
Column spanning
| | Grouping ||
| Header | A | B |
| ---------- | :------: | -------: |
| Data | spans ||
| Grouping | ||
|---|---|---|
| Header | A | B |
| Data | spans | |
Caption with label
[Sales Data][sales]
| Q1 | Q2 |
| ---- | ---- |
| 100 | 120 |
| Q1 | Q2 |
|---|---|
| 100 | 120 |
Row spanning (rowspan: true)
| A | B | C |
| ------ | -- | -- |
| tall | 1 | x |
| ^^ | 2 | y |
| A | B | C |
|---|---|---|
| tall | 1 | x |
| 2 | y |
Multiline cells (multiline: true)
| Code | Output |
| --------------- | ------- |
| ```python | |\
| print("hello") | hello |\
| ``` | |
| Code | Output |
|---|---|
|
hello |
Headerless table (headerless: true)
| -------- | ----- |
| No header| here |
| No header | here |
Attribute lists on cells and rows (attr_list: true)
Place a {…} block at the end of a cell to add HTML attributes to that cell.
The block supports .class, #id, and key="value" tokens — the same syntax
as the standard attr_list
Markdown extension.
Cell attributes — append {…} inside the cell, before the closing |:
| Header |
| ----------------------------- |
| plain cell |
| styled cell {.highlight} |
| id cell {#cell-1} |
| full {#c2 .bold data-x="1"} |
<table>
<thead>
<tr><th>Header</th></tr>
</thead>
<tbody>
<tr><td>plain cell</td></tr>
<tr><td class="highlight">styled cell</td></tr>
<tr><td id="cell-1">id cell</td></tr>
<tr><td id="c2" class="bold" data-x="1">full</td></tr>
</tbody>
</table>
Row attributes — append {…} after the last | of a row:
| A | B |
| - | - |
| x | y |{.even}
| p | q |{.odd #row-2}
<table>
<thead>
<tr><th>A</th><th>B</th></tr>
</thead>
<tbody>
<tr class="even"><td>x</td><td>y</td></tr>
<tr class="odd" id="row-2"><td>p</td><td>q</td></tr>
</tbody>
</table>
Combined — cell and row attributes can be used together:
| H |
| ------------------ |
| cell {.myclass} |{.myrow}
<table>
<thead>
<tr><th>H</th></tr>
</thead>
<tbody>
<tr class="myrow"><td class="myclass">cell</td></tr>
</tbody>
</table>
Development
pip install -e ".[dev]"
pytest tests/
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 pymdown_multimd_table-0.1.1.tar.gz.
File metadata
- Download URL: pymdown_multimd_table-0.1.1.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fae94a844d19f5da4dec6294b52de34c5d539a14619799bcc206e2ddfcf924e2
|
|
| MD5 |
eaa8d644f9874ad8a6fe9ac73e1d94b2
|
|
| BLAKE2b-256 |
2a437bdbf61093ec2018456837b4cd9c39bc381ac79d0f3a264b07e220213d74
|
Provenance
The following attestation bundles were made for pymdown_multimd_table-0.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on joapuiib/pymdown-multimd-table
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymdown_multimd_table-0.1.1.tar.gz -
Subject digest:
fae94a844d19f5da4dec6294b52de34c5d539a14619799bcc206e2ddfcf924e2 - Sigstore transparency entry: 1317097985
- Sigstore integration time:
-
Permalink:
joapuiib/pymdown-multimd-table@4dfa4bde5ff48d088f4fea93c98fb655236e5665 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/joapuiib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4dfa4bde5ff48d088f4fea93c98fb655236e5665 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pymdown_multimd_table-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pymdown_multimd_table-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.7 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 |
eefc9074a46adefe8529d52a7994f546e225bbda37b3071dce8e0dd97b351605
|
|
| MD5 |
bbd78ba7b6a3737b93a5908d8756338e
|
|
| BLAKE2b-256 |
0237101af3a28ada0f1617e7f4bfbc31ac3608be23a80ff62cbf48155f50ca2a
|
Provenance
The following attestation bundles were made for pymdown_multimd_table-0.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on joapuiib/pymdown-multimd-table
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymdown_multimd_table-0.1.1-py3-none-any.whl -
Subject digest:
eefc9074a46adefe8529d52a7994f546e225bbda37b3071dce8e0dd97b351605 - Sigstore transparency entry: 1317097992
- Sigstore integration time:
-
Permalink:
joapuiib/pymdown-multimd-table@4dfa4bde5ff48d088f4fea93c98fb655236e5665 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/joapuiib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4dfa4bde5ff48d088f4fea93c98fb655236e5665 -
Trigger Event:
push
-
Statement type: