Closed kevinjwz closed 2 years ago
Strange enough, if the first <th>
is empty, and remove indentations in source, things seem to work:
- XXXXXXXX
|abc|
|---|---|
|abc|abc|
With multimd-table:
<ul>
<li>
<p>XXXXXXXX</p>
<table>
<thead>
<tr><th></th><th>abc</th></tr>
</thead>
<tbody>
<tr><td>abc</td><td>abc</td></tr>
</tbody>
</table>
</li>
</ul>
So the key might be "no beginning | at all":
- XXXXXXXX
abc|abc|
---|---|
abc|abc|
or "keep the seperator line unindented":
- XXXXXXXX
abc|abc|
|---|---|
abc|abc|
Both give the right result.
I cannot reproduce the failed case in your first comment. Below is the script:
var md = require('markdown-it')({ html: true, breaks: true })
.use(require('furigana-markdown-it'), { fallbackParens: '{}' })
.use(require('markdown-it-multimd-table'), { rowspan: true, headerless: true })
.use(require('markdown-it-mark'))
.use(require('markdown-it-attrs'))
.use(require('markdown-it-emoji'), { defs: { v: '✔️', x: '❌' } });
const exampleTable =
"- XXXXXXXX\n" +
"\n" +
" |abc|abc|\n" +
" |---|---|\n" +
" |abc|abc|\n";
console.log(md.render(exampleTable));
It gives out an expected result, a nested table. Is there something missed in the script?
I use markdown-it on browser. Below is the minimalized test page:
<!DOCTYPE html>
<html>
<head></head>
<body>
<script src="./markdown-it.min.js"></script>
<script src="./markdown-it-multimd-table.min.js"></script>
<script>
let md = markdownit().use(markdownitMultimdTable);
const exampleTable =
"- XXXXXXXX\n" +
"\n" +
" |abc|abc|\n" +
" |---|---|\n" +
" |abc|abc|\n";
console.log(md.render(exampleTable));
</script>
</body>
</html>
reproduced on: Edge 103.0.1264.62 Firefox 103.0
I had the minifier misfigured, where the plugin exported the collided name markdownit
.
Please checkout markdown-it-multimd-table.min.js from fix-minify
branch to see if it gives the expected result.
I'd like a table within
<li>
to get consistent indentation.Markdown source:
Without multimd-table:
With multimd-table:
My configuration: