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

🐛 BUG: Adding of markdown plugins stopped working #2642

Closed
rebelchris opened this issue Feb 22, 2022 · 4 comments
Closed

🐛 BUG: Adding of markdown plugins stopped working #2642

rebelchris opened this issue Feb 22, 2022 · 4 comments

Comments

@rebelchris
Copy link
Contributor

What version of astro are you using?

0.23.0-next.10

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

I've been trying to get a autolinks-headings plugin to work in Astro.
Following the documentation on it didn't work.

Then I found this stackblitz which uses v0.21 which works:
https://stackblitz.com/edit/github-ajreza-yea7u7?file=package.json

I've forked it and updated to v0.23 to see it stopped working:
https://stackblitz.com/edit/github-ajreza-yeerse?file=package.json

Think this might have been broke between 21 and 23?

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ajreza-yeerse?file=package.json

@JuanM04
Copy link
Contributor

JuanM04 commented Feb 22, 2022

There was a change about how to import plugins in Astro to follow what the docs says (instead of the weird {default: ...} hack):

#2534

@rebelchris
Copy link
Contributor Author

@JuanM04 Ah ok, well forget about that part even.

When I use the following it also doesn't do anything on v0.23

markdownOptions: {
    render: [
      astroRemark,
      {
        remarkPlugins: ["remark-code-titles"],
        rehypePlugins: [
          ["rehype-autolink-headings", { behavior: "prepend" }],
          ["rehype-toc", { headings: ["h2", "h3"] }],
          "rehype-slug",
        ],
      },
    ],
  },

@JuanM04
Copy link
Contributor

JuanM04 commented Feb 23, 2022

I can't replicate. It seems to work with v0.23: https://stackblitz.com/edit/github-tkhs8z?file=astro.config.mjs

@rebelchris
Copy link
Contributor Author

rebelchris commented Feb 23, 2022

It seems to do more on 0.23 without the next version indeed!
But in your example the headings are not converted to links?
Or am I missing something in the autolink-headings idea?

Edit:
The order seems to be important this works:

markdownOptions: {
    render: [
      astroRemark,
      {
        remarkPlugins: ["remark-code-titles"],
        rehypePlugins: [
          "rehype-slug",
          ["rehype-autolink-headings", { behavior: "prepend" }],
          ["rehype-toc", { headings: ["h2", "h3"] }],
        ],
      },
    ],
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants