-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Docs/mdx component to markdoc #22030
Conversation
Deploy preview for dagster-docs ready! Preview available at https://dagster-docs-9ey9ydf2l-elementl.vercel.app Direct link to changed pages: |
Deploy preview for dagster-university ready! ✅ Preview Built with commit 32be57b. |
32be57b
to
97ca067
Compare
Basically, making it so buttons don't cause that weird hydration issue with Next.
…ren discovered during testing. Adding unpackText util Using unpackText util in other markdoc tag components.
- Icon does not start at top of the page with text. Markdoc changes the order that CSS classes get applied to child elements compared to preexisting MDX approach so some changes are required to make sure the child elements style correctly. - Child text does not receive colors.text style for some element types. - Child text does not receive text-sm class in some cases. The function applyTextStyles addresses this.
This reverts commit 01203f4. On branch docs/mdx-component-to-markdoc Your branch is up to date with 'origin/docs/mdx-component-to-markdoc'. Changes to be committed: modified: docs/next/markdoc/nodes/index.ts deleted: docs/next/markdoc/nodes/link.markdoc.ts Reverting this commit to have it be a separate pull request for easier reviewing.
97ca067
to
537c67e
Compare
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.
Thanks so much @nikomancy 🙏
## Summary & Motivation Made in response to issues identified in dagster-io#22025 ### Issue The previous PR caused issues due to both MDX and Markdoc attempting to render using the same Callout component. Markdoc and MDX have different AST formats which results in them passing different children and props to the React components. ### Approach I've added a component for callouts into the MDXComponents.tsx file. This component outputs the same visuals for Callouts including the minor changes we've recently made while restyling the Docs. This duplicate will be able to work with the MDX source and will leave the Markdoc component free to iterate and use the full suite of capabilities Markdoc has without having to worry about interop. While it is tempting to try to have both MDX and Markdoc content render using a single component, there are a set of reasons why this is impractical. - The different ASTs between the two source formats would require logic. - Our MDX implementation requires all components and each of their dependencies be explicitly passed through the MDXComponents.tsx file. Markdoc has cleaner, modularized components and for them to work with MDX, we would need to write the Markdoc components in a way that works with our MDXComponent.tsx approach too. - Given our imminent intent to move away from authoring any further content in MDX, it makes more economic sense to just have duplicate components for our two source content formats in the interim period while we migrate. ## How I Tested These Changes Ran local server. Checked known list of pages that were not working due to previous PR: - http://localhost:3001/getting-started/quickstart - http://localhost:3001/tutorial/introduction - http://localhost:3001/tutorial/introduction - http://localhost:3001/tutorial/setup - http://localhost:3001/tutorial/building-an-asset-graph - http://localhost:3001/tutorial/scheduling-your-pipeline - http://localhost:3001/tutorial/connecting-to-external-services Confirmed Callouts look the same between an MDX page (http://localhost:3001/getting-started/quickstart) and a Markdoc page (http://localhost:3001/getting-started/install)
Summary & Motivation
Made in response to issues identified in #22025
Issue
The previous PR caused issues due to both MDX and Markdoc attempting to render using the same Callout component. Markdoc and MDX have different AST formats which results in them passing different children and props to the React components.
Approach
I've added a component for callouts into the MDXComponents.tsx file. This component outputs the same visuals for Callouts including the minor changes we've recently made while restyling the Docs. This duplicate will be able to work with the MDX source and will leave the Markdoc component free to iterate and use the full suite of capabilities Markdoc has without having to worry about interop.
While it is tempting to try to have both MDX and Markdoc content render using a single component, there are a set of reasons why this is impractical.
How I Tested These Changes
Ran local server. Checked known list of pages that were not working due to previous PR:
Confirmed Callouts look the same between an MDX page (http://localhost:3001/getting-started/quickstart)
and a Markdoc page (http://localhost:3001/getting-started/install)