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

MD/MDX collect headings refactor #5654

Merged
merged 7 commits into from
Dec 20, 2022
Merged

MD/MDX collect headings refactor #5654

merged 7 commits into from
Dec 20, 2022

Conversation

delucis
Copy link
Member

@delucis delucis commented Dec 20, 2022

Changes

  • Consolidate MD/MDX collect headings logic
  • Expose rehypeHeadingSlugs to Astro users via @astrojs/markdown-remark
  • Flip order of execution for MDX: inject heading IDs after user plugins to match Markdown behaviour
  • Reuse rehypeHeadingSlugs in MDX integration instead of copy/paste duplication
  • Minor releases for both @astrojs/markdown-remark and @astrojs/mdx (minor == breaking pre v1)

Supersedes #5646

Testing

Added tests for:

  • being able to override ID generation with the default config
  • being able to inject IDs early by using rehypeHeadingSlugs directly

Docs

Updated the Markdown guide in withastro/docs#2216
/cc @withastro/maintainers-docs for feedback!

@changeset-bot
Copy link

changeset-bot bot commented Dec 20, 2022

🦋 Changeset detected

Latest commit: 13d0c0b

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

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 the feat: markdown Related to Markdown (scope) label Dec 20, 2022
@delucis delucis self-assigned this Dec 20, 2022
@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Dec 20, 2022
@delucis delucis marked this pull request as ready for review December 20, 2022 19:03
@delucis delucis changed the title [WIP] MD/MDX collect headings refactor MD/MDX collect headings refactor Dec 20, 2022
@delucis delucis requested a review from bholmesdev December 20, 2022 19:04
Copy link
Contributor

@bholmesdev bholmesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remarkable 👏

packages/markdown/remark/src/types.ts Show resolved Hide resolved
@delucis delucis merged commit 2c65b43 into main Dec 20, 2022
@delucis delucis deleted the chris/collect-headings branch December 20, 2022 22:08
@astrobot-houston astrobot-houston mentioned this pull request Dec 20, 2022
@delucis delucis restored the chris/collect-headings branch December 21, 2022 17:48
@delucis delucis deleted the chris/collect-headings branch December 21, 2022 17:48
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: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants