Skip to content

Remark-captions not rendering table caption #513

@alexander-turner

Description

@alexander-turner

When I run node on the following code:

import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";
import remarkCaptions from "remark-captions";

const processor = unified()
  .use(remarkParse)
  .use(remarkCaptions)
  .use(remarkRehype)
  .use(rehypeStringify);

const markdown = `
head1| head2
-----|------
bla|bla
Table: figcapt1`;

processor.process(markdown, (err, file) => {
  if (err) throw err;
  console.log(String(file));
});

The following is produced:

<p>head1| head2
-----|------
bla|bla
Table: figcapt1</p>

However, according to the remark-captions README, it should produce:

<figure>
  <table>
    <thead>
      <tr>
        <th>head1</th>
        <th>head2</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>bla</td>
        <td>bla</td>
      </tr>
    </tbody>
  </table>
  <figcaption>figcapt1</figcaption>
</figure>

Metadata

Metadata

Assignees

No one assigned

    Labels

    semver/bugfixThis is a minor backward-compatible fixstatus/verifiedThis has been checked by a maintainertype/bugThis is a problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions