marp-team / marp-core

The core of Marp converter
MIT License
800 stars 132 forks source link

Support for merge cells in tables #373

Open josecastillolema opened 6 months ago

josecastillolema commented 6 months ago

First of all, thanks for the amazing tool!

I was wondering if there is a way to merge cells in a table.

If there is not, I personally found doxygen format very straighforward:

| Cell1| Cell2 | Cell3 |
|------|-------|-------|
| merge right ||       |
| merge|       |       |
| below|^      |^      |
| merge both  || value1|
|^            || value2|
yhatt commented 6 months ago

That syntax is not defined in the specifications for GFM (GitHub Flavored Markdown). There are only a few Markdown flavors that adopt that syntax, and if Marp adopts that, it could negatively impact interoperability with other Markdown processors. Therefore, this feature should be provided as a third-party plugin (e.g. markdown-it-multimd-table)

import { Marp } from '@marp-team/marp-core';
import markdownItMultimdTable from 'markdown-it-multimd-table';

const marp = new Marp().use(markdownItMultimdTable);

marp.render(/* ... */);
josecastillolema commented 6 months ago

Thanks for the quick response.

Where do these imports should be placed? In the markdown file?

yhatt commented 6 months ago

See the usage section of this repository. Marp Core is a JavaScript library so the plugin also should import in JavaScript.

Or are you using Marp Core indirectly, through other tools such as Marp CLI?

josecastillolema commented 6 months ago

Yeah, I am using Marp Core through the VSCode extension. In this scenario, where should I place this setup?

Thanks!

yhatt commented 6 months ago

VS Code does not support any plugins due to security reasons. Check out https://github.com/marp-team/marp-vscode/issues/135#issuecomment-611275071.

Whenever using plugins, you have to use Marp CLI instead.