astro icon indicating copy to clipboard operation
astro copied to clipboard

make Remark rehype options available in astro config

Open gtnbssn opened this issue 3 years ago • 2 comments

Changes

  • Allows to set remark-rehype options in astro.config.mjs
  • See options here https://github.com/remarkjs/remark-rehype#options
  • Astro has {allowDangerousHtml: true, passThrough: ["raw", "mdxTextExpression", "mdxJsxTextElement", "mdxJsxFlowElement"]} by default, this keeps them and will extend the values with what goes in the astro.config.mjs
  • This should allow to set other options, notably footerLabel to close #3163

Testing

Add this in astro.config.mjs

markdown: {
  remarkRehype: {
    footnoteLabel : "other title for footnotes",
    footnoteBackLabel: 'other text for the link back to content',
  }
}

Create a markdown page with a least one footnote and check that the title for the footnotes section has been updated.

Docs

I'll update (if necessary) and reopen docs#445 if this passes.

gtnbssn avatar Aug 04 '22 01:08 gtnbssn

🦋 Changeset detected

Latest commit: 2f2271df3e760b92018b4e5ea41f0ad294c8fce3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
astro Minor
@astrojs/markdown-remark Minor
@e2e/astro-component Patch
@e2e/error-react-spectrum Patch
@e2e/error-sass Patch
@e2e/errors Patch
@e2e/hydration-race Patch
@e2e/lit-component Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component Patch
@e2e/solid-recurse Patch
@e2e/svelte-component Patch
@e2e/e2e-tailwindcss Patch
@e2e/ts-resolution Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 04 '22 01:08 changeset-bot[bot]

@EiffelFly i think this is it! I had to explicitly import the types for handlers and add them back in the RemarkRehype type.

I don't think the failing tests are related to this patch so hopefully this is ok.

gtnbssn avatar Aug 04 '22 01:08 gtnbssn

Making a note to pull this from the MDX integration! I'll make a separate PR for that when this is merged 👍

bholmesdev avatar Aug 23 '22 19:08 bholmesdev