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

make Remark rehype options available in astro config #4138

Merged
merged 15 commits into from
Aug 25, 2022

Conversation

gtnbssn
Copy link
Contributor

@gtnbssn gtnbssn commented Aug 4, 2022

Changes

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.

@changeset-bot
Copy link

changeset-bot bot commented Aug 4, 2022

🦋 Changeset detected

Latest commit: 2f2271d

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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) feat: markdown Related to Markdown (scope) labels Aug 4, 2022
@gtnbssn
Copy link
Contributor Author

gtnbssn commented Aug 4, 2022

@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.

@matthewp matthewp added the semver: minor Change triggers a `minor` release label Aug 23, 2022
@bholmesdev
Copy link
Contributor

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

@matthewp matthewp merged commit 839097c into withastro:main Aug 25, 2022
This was referenced Aug 25, 2022
@backflip
Copy link
Contributor

@bholmesdev, should this work with MDX already? The following config does not overwrite the title for me when using .mdx files:

export default defineConfig({
  integrations: [
    mdx(),
  ],
  markdown: {
    remarkRehype: {
      footnoteLabel: "Hi Ben",
    },
  },
});

@astro/mdx@0.11.6

@backflip
Copy link
Contributor

backflip commented Nov 17, 2022

@bholmesdev, I guess we would have to pass remarkRehypeOptions: config.markdown.remarkRehype to https://github.com/withastro/astro/blob/main/packages/integrations/mdx/src/index.ts#L65

Is this something you would want to combine with custom remarkRehypeOptions on mdxOptions and something like extendOptions to define the inheritance behavior?

@bholmesdev
Copy link
Contributor

bholmesdev commented Nov 17, 2022

@backflip Ah, right you are! I agree this should be applied when extendPlugins: 'markdown' is set in your MDX config (which is the default). We'd likely apply the remark-rehype plugin alongside your other remark plugins if this option is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: markdown Related to Markdown (scope) pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release
Projects
None yet
6 participants