Skip to content

Multiline Cells

Optional feature

Multiline cells require multiline: true in your configuration.

markdown_extensions:
  - pymdown_multimd_table:
      multiline: true

End a row with a backslash \ to continue the current cell content on the next line. The lines are joined into a single cell and parsed as a block of Markdown.

Basic multiline

| Code           | Output   |
| :------------- | :------- |
| line1          | x       \
| line2          | y       \
| line3          | z        |
Code Output

line1 line2 line3

x y z

<table>
<thead>
<tr>
<th style="text-align:left">Code</th>
<th style="text-align:left">Output</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<p>line1
line2
line3</p>
</td>
<td style="text-align:left">
<p>x
y
z</p>
</td>
</tr>
</tbody>
</table>

Fenced code block inside a cell

Use the fenced_code extension alongside multiline to embed code blocks:

| Code                    | Result  |
| :---------------------- | :------ |
| ``` python             | hello  |\
| print("hello")         |        |\
| ```                    |         |
Code Result
print("hello")

hello

<table>
<thead>
<tr>
<th style="text-align:left">Code</th>
<th style="text-align:left">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nb">print</span><span class="p">(</span><span class="s2">&quot;hello&quot;</span><span class="p">)</span>
</code></pre></div>
</td>
<td style="text-align:left">
<p>hello</p>
</td>
</tr>
</tbody>
</table>

Bulleted list inside a cell

| Steps                   |
| :---------------------- |
| - Install dependencies |\
| - Run `mkdocs serve`   |\
| - Open your browser     |
Steps
  • Install dependencies
  • Run mkdocs serve
  • Open your browser
<table>
<thead>
<tr>
<th style="text-align:left">Steps</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<ul>
<li>Install dependencies</li>
<li>Run <code>mkdocs serve</code></li>
<li>Open your browser</li>
</ul>
</td>
</tr>
</tbody>
</table>

Nested list inside a cell

Relative indentation is preserved, so nested lists work correctly:

| Menu                    |
| :---------------------- |
| - Fruit                |\
|     - Apple            |\
|     - Banana           |\
| - Vegetable             |
Menu
  • Fruit
    • Apple
    • Banana
  • Vegetable
<table>
<thead>
<tr>
<th style="text-align:left">Menu</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<ul>
<li>Fruit<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
</li>
<li>Vegetable</li>
</ul>
</td>
</tr>
</tbody>
</table>

Blockquote inside a cell

| Quote                    | Author      |
| :----------------------- | :---------- |
| > To be, or not to be,  | Shakespeare |\
| > that is the question. |             |
Quote Author

To be, or not to be, that is the question.

Shakespeare

<table>
<thead>
<tr>
<th style="text-align:left">Quote</th>
<th style="text-align:left">Author</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<blockquote>
<p>To be, or not to be,
that is the question.</p>
</blockquote>
</td>
<td style="text-align:left">
<p>Shakespeare</p>
</td>
</tr>
</tbody>
</table>

Admonition inside a cell

Requires the admonition extension.

| Feature       | Notes                        |
| :------------ | :--------------------------- |
| Admonitions   | !!! note                    |\
|               |     Works inside a cell!     |
| Custom title  | !!! warning "Heads up"      |\
|               |     Check your config.       |
Feature Notes

Admonitions

Note

Works inside a cell!

Custom title

Heads up

Check your config.

<table>
<thead>
<tr>
<th style="text-align:left">Feature</th>
<th style="text-align:left">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<p>Admonitions</p>
</td>
<td style="text-align:left">
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Works inside a cell!</p>
</div>
</td>
</tr>
<tr>
<td style="text-align:left">
<p>Custom title</p>
</td>
<td style="text-align:left">
<div class="admonition warning">
<p class="admonition-title">Heads up</p>
<p>Check your config.</p>
</div>
</td>
</tr>
</tbody>
</table>

Definition list inside a cell

Requires the def_list extension.

| Term          | Definition                   |
| :------------ | :--------------------------- |
| Apple         | Apple                       |\
|               | :   A sweet fruit            |
| Python        | Python                      |\
|               | :   A programming language   |
Term Definition

Apple

Apple
A sweet fruit

Python

Python
A programming language
<table>
<thead>
<tr>
<th style="text-align:left">Term</th>
<th style="text-align:left">Definition</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<p>Apple</p>
</td>
<td style="text-align:left">
<dl>
<dt>Apple</dt>
<dd>A sweet fruit</dd>
</dl>
</td>
</tr>
<tr>
<td style="text-align:left">
<p>Python</p>
</td>
<td style="text-align:left">
<dl>
<dt>Python</dt>
<dd>A programming language</dd>
</dl>
</td>
</tr>
</tbody>
</table>

Notes

  • Backslash continuation only works in body rows. A backslash at the end of a header row has no effect.
  • With multiline: false (the default), a trailing \ is kept as literal cell content.
  • Colspan is preserved across continuation lines.