Metadata-Version: 2.4
Name: mdit-py-adv-table
Version: 0.2.0
Summary: Advanced table syntax plugin for markdown-it-py
Author: yamavol
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: markdown-it-py>=3.0.0,<5.0.0
Requires-Dist: myst-parser>=3.0.0 ; extra == 'sphinx'
Requires-Dist: sphinx>=8.1.3 ; extra == 'sphinx'
Requires-Python: >=3.10
Provides-Extra: sphinx
Description-Content-Type: text/markdown


# mdit-py-adv-table

A [markdown-it-py](https://www.npmjs.com/package/markdown-it) plugin for advanced table rendering. This is a python-port of [markdown-it-adv-table](https://www.npmjs.com/package/markdown-it-adv-table).

This plugin adds custom table syntaxes to render complex tables easier. 

- "flat-table" syntax
- "csv-table" syntax
- "tsv-table" syntax

The "flat-table" syntax allows to:

- Set Rowspan and colspan for spanning cells
- Set column width
- Set horizontal text alignment
- Set css classes for table styling
- Define Header rows and columns
- Allow writing markdown inside the cells (nested document)

## Installation

```sh
pip install mdit-py-adv-table
```

```py
from mdit_py_adv_table import adv_table
from markdown_it import MarkdownIt
md = MarkdownIt().use(adv_table)
md.render("...")
```

<table>
<tr>
    <th>PluginName</th>
    <th>LangName</th>
    <th>Behavior</th>
</tr>
<tr>
    <td><code>adv_table</code></td>
    <td>table*</td>
    <td>Installs an all-unified plugin</td>
</tr>
<tr>
    <td><code>flat_table</code></td>
    <td>flat-table</td>
    <td>render table from the flat-table syntax</td>
</tr>
<tr>
    <td><code>csv_table</code></td>
    <td>csv-table</td>
    <td>render table from csv</td>
</tr>
<tr>
    <td><code>tsv_table</code></td>
    <td>tsv-table</td>
    <td>render table from tsv</td>
</tr>
</table>

## Example

``````
```table cols=4 header-rows=2 header-cols=1
r2| Category
c3| Q1 Sales

| January
| February
| March

| Electronics
| $10,000
| $12,000
| $11,500

| Clothing
| $8,000
| $9,500
| $9,000

| Books
| $3,500
| $4,000
| $4,200
```
``````

<table>
  <thead>
    <tr>
      <th rowspan="2">Category</th>
      <th colspan="3">Q1 Sales</th>
    </tr>
    <tr>
      <th>January</th>
      <th>February</th>
      <th>March</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>Electronics</th>
      <td>$10,000</td>
      <td>$12,000</td>
      <td>$11,500</td>
    </tr>
    <tr>
      <th>Clothing</th>
      <td>$8,000</td>
      <td>$9,500</td>
      <td>$9,000</td>
    </tr>
    <tr>
      <th>Books</th>
      <td>$3,500</td>
      <td>$4,000</td>
      <td>$4,200</td>
    </tr>
  </tbody>
</table>

## Syntax Description

see [markdown-it-adv-table](https://www.npmjs.com/package/markdown-it-adv-table)

## Sphinx & MyST Integration

This package provides an extension for Sphinx with MyST parser.