Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remark-captions not rendering table caption #513

Open
alexander-turner opened this issue Aug 13, 2024 · 2 comments
Open

Remark-captions not rendering table caption #513

alexander-turner opened this issue Aug 13, 2024 · 2 comments
Labels
semver/bugfix This is a minor backward-compatible fix status/verified This has been checked by a maintainer type/bug This is a problem

Comments

@alexander-turner
Copy link

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>
@StaloneLab
Copy link
Member

Just in case, could you tell which version of remark-parse you are using? Captions work for images at least on latest remark, but support for tables might have been broken at some point, unsure if it might be linked to new remark@13 or not. It shouldn't, but who knows?

@alexander-turner
Copy link
Author

(It works for images on mine too)

@StaloneLab StaloneLab added type/bug This is a problem semver/bugfix This is a minor backward-compatible fix status/verified This has been checked by a maintainer labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/bugfix This is a minor backward-compatible fix status/verified This has been checked by a maintainer type/bug This is a problem
Projects
None yet
Development

No branches or pull requests

2 participants