@paperist/remark-table-captiondeprecated

wooorm/remark plugin for table caption

Usage no npm install needed!

<script type="module">
  import paperistRemarkTableCaption from 'https://cdn.skypack.dev/@paperist/remark-table-caption';
</script>

README

@paperist/remark-table-caption

LICENSE NPM standard-readme compliant

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

3846masa MIT (c) 3846masa