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

Simplify plain MDX nodes in optimize option #10934

Merged
merged 4 commits into from
May 2, 2024
Merged

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented May 2, 2024

Changes

Some MDX nodes are simply <kbd>something</kbd> which the optimizer bails out because it thinks that it's non-static. However, it works like a plain HTML element and should be static.

This PR tries to simplify these MDX nodes as normal hast element nodes so we can further optimize the strings.

Testing

Added a new test

Docs

Added a changeset

Copy link

changeset-bot bot commented May 2, 2024

🦋 Changeset detected

Latest commit: 26992d5

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 pkg: integration Related to any renderer integration (scope) label May 2, 2024
Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

LGTM!

@bluwy bluwy merged commit ec442ec into mdx-v3 May 2, 2024
13 checks passed
@bluwy bluwy deleted the optimize-simplify-mdx-nodes branch May 2, 2024 12:00
@bluwy bluwy mentioned this pull request May 2, 2024
ematipico pushed a commit that referenced this pull request May 8, 2024
* fix(mdx): convert remark-images-to-component plugin to a rehype plugin (#10697)

* Remove fs read for MDX transform (#10866)

* Tag MDX component for faster checks when rendering (#10864)

* Use unified plugin only for MDX transform (#10869)

* Only traverse children and handle mdxJsxTextElement when optimizing (#10885)

* Rename to `optimize.ignoreComponentNames` in MDX (#10884)

* Allow remark/rehype plugins added after mdx to work (#10877)

* Improve MDX optimize with sibling nodes (#10887)

* Improve types in rehype-optimize-static.ts

* Rename `ignoreComponentNames` to `ignoreElementNames`

I think this better reflects what it's actually doing

* Simplify plain MDX nodes in optimize option (#10934)

* Format code

* Minimize diff changes

* Update .changeset/slimy-cobras-end.md

Co-authored-by: Sarah Rainsberger <[email protected]>

---------

Co-authored-by: Armand Philippot <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants