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

Fix: use set:html when markdown mode is md #4008

Merged
merged 15 commits into from
Jul 21, 2022

Conversation

bholmesdev
Copy link
Contributor

@bholmesdev bholmesdev commented Jul 21, 2022

Changes

  • Wrap markdown in a set:html fragment when the markdown.mode configuration is md. This prevents JSX expressions from getting parsed when users have opted out of "MDX mode."
  • Move MDX-specific remark and rehype plugins under isMDX flag
  • Ignore setup and components in plain MD mode

Testing

Test JSX expressions, components, and syntax highlighting -> astro-markdown-md-mode.test.js

Docs

N/A! According to the docs, this is what 'md' mode always should've done.

@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2022

🦋 Changeset detected

Latest commit: f9a1bbc

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

This PR includes changesets to release 13 packages
Name Type
astro Patch
@astrojs/markdown-remark Patch
@e2e/astro-component Patch
@e2e/error-react-spectrum Patch
@e2e/error-sass Patch
@e2e/errors Patch
@e2e/lit-component Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component 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

@bholmesdev bholmesdev marked this pull request as draft July 21, 2022 15:27
@bholmesdev bholmesdev changed the title Fix: use set:html when markdown mode is _not_ mdx Fix: use set:html when markdown mode is md Jul 21, 2022
@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) feat: markdown Related to Markdown (scope) labels Jul 21, 2022
@bholmesdev bholmesdev marked this pull request as ready for review July 21, 2022 16:13
Comment on lines -96 to -98
.use(rehypeEscape)
.use(rehypeIslands)
.use([rehypeCollectHeaders])
Copy link
Contributor Author

@bholmesdev bholmesdev Jul 21, 2022

Choose a reason for hiding this comment

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

All JSX or Astro component specific! Move under isMDX flag.

Comment on lines -49 to -50
.use(isMDX ? [remarkMdxish, remarkMarkAndUnravel] : [])
.use([remarkUnwrap, remarkEscape]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All JSX or Astro component specific! Move under isMDX flag.

@natemoo-re natemoo-re mentioned this pull request Jul 21, 2022
20 tasks
@bholmesdev bholmesdev force-pushed the fix/use-set-html-for-non-mdx-markdown-renderers branch from 6244c67 to 96f04a6 Compare July 21, 2022 20:27
@bholmesdev bholmesdev merged commit 399d7e2 into main Jul 21, 2022
@bholmesdev bholmesdev deleted the fix/use-set-html-for-non-mdx-markdown-renderers branch July 21, 2022 22:01
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants