wooorm/remark plugin for table caption
Support Pandoc's table caption at wooorm/remark.
Table of Contents
Install
npm i remark @paperist/remark-table-caption
Usage
const unified = require('unified');
const parser = require('remark-parse');
const tableCaption = require('@paperist/remark-table-caption');
const markdown = `
| Right | Left | Default | Center |
|------:|:-----|---------|:------:|
| 12 | 12 | 12 | 12 |
| 123 | 123 | 123 | 123 |
| 1 | 1 | 1 | 1 |
Table: Demonstration of pipe table syntax.
`;
const processor = unified().use(parser).use(tableCaption);
const ast = processor.parse(markdown);
processor.run(ast).then(ast => {
console.dir(ast, { depth: null });
});
AST
See also mdast, unist.
TableCaption
TableCaption
extends [Parent
][unist-parnet].
interface TableCaption extends Parent {
type: 'tableCaption';
}
For example, the following markdown:
Table: Caption {#tbl:label}
Yields:
{
"type": "tableCaption",
"children": [
{
"type": "text",
"value": "Caption "
},
{
"type": "crossReferenceLabel",
"value": "{#tbl:lable}",
"label": "tbl:label",
"options": {}
}
]
}
Contribute
PRs accepted.
License
MIT (c) 3846masa