-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 mdx not rendering #7168
base: main
Are you sure you want to change the base?
fix mdx not rendering #7168
Conversation
🦋 Changeset detectedLatest commit: eb47d90 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
commit: |
@shairez I'm not sure this is necessary. The Qwik UI docs use an mdx recma plugin hack that I implemented back then. So your fix here would be fixing a hack inside of Qwik UI in a way 😅. I got the Qwik UI docs to work by simply removing the plugin. This seems to work now since Woot changed the underlying implementation. I was going to make a PR, but no time for it when I was in China 🙈 |
thanks @maiieul closing |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Re-opening after discussion with Maieul |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the feedback above, LGTM
@@ -5,6 +5,7 @@ import type { BuildContext } from '../types'; | |||
import { parseFrontmatter } from './frontmatter'; | |||
import { getExtension } from '../../utils/fs'; | |||
import type { CompileOptions } from '@mdx-js/mdx'; | |||
import { createHash } from 'node:crypto'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok if we rely on node here for the hash?
Math.random().toString(26).split(".").pop()
Maybe something like this is preferred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it's in build time, I think it's OK (I also checked and this should be supported by both deno and bun)
const WrappedMdxContent = () => { | ||
const content = _createMdxContent({}); | ||
return typeof MDXLayout === 'function' ? jsx(MDXLayout, {children: content}) : content; | ||
const content = _jsxC(RenderOnce, {children: _jsxC(_createMdxContent, {}, 3, null)}, 3, ${JSON.stringify(key)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are only added to the v1 codebase right? Otherwise in v2 these would break with different transform functions being used like jsxsplit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
const WrappedMdxContent = () => { | ||
const content = _createMdxContent({}); | ||
return typeof MDXLayout === 'function' ? jsx(MDXLayout, {children: content}) : content; | ||
const content = _jsxC(RenderOnce, {children: _jsxC(_createMdxContent, {}, 3, null)}, 3, "eB2HIyA1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job on the unit test. Looks like if we do run into a problem with the transforms we'll know pretty quickly with this
What is it?
Description
For some reason, the Qwik UI docs didn't render with version 1.10.0 because they are based on mdx.
Apparently #6845 broke it.
But this seems to fix it.
Couldn't setup a breaking test for this one (it happens only in dev mode, and the CLI e2e passed with my attempt to break it).
It also seems like this is solved in V2, so this will be a quick (qwik) fix until V2 is released and then we'll dig into it more.
Checklist
pnpm change