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

Docs/mdx component to markdoc #22030

Merged
merged 27 commits into from
May 22, 2024
Merged

Docs/mdx component to markdoc #22030

merged 27 commits into from
May 22, 2024

Conversation

nikomancy
Copy link
Contributor

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.

  • 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:

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)

@graphite-app graphite-app bot added the area: docs Related to documentation in general label May 22, 2024
Copy link

github-actions bot commented May 22, 2024

Deploy preview for dagster-docs ready!

Preview available at https://dagster-docs-9ey9ydf2l-elementl.vercel.app
https://docs-mdx-component-to-markdoc.dagster.dagster-docs.io

Direct link to changed pages:

@graphite-app graphite-app bot added the area: dagster-university Related to Dagster University label May 22, 2024
Copy link

Deploy preview for dagster-university ready!

✅ Preview
https://dagster-university-5lz1wg7h4-elementl.vercel.app
https://docs-mdx-component-to-markdoc.dagster-university.dagster-docs.io

Built with commit 32be57b.
This pull request is being automatically deployed with vercel-action

@nikomancy nikomancy force-pushed the docs/mdx-component-to-markdoc branch from 32be57b to 97ca067 Compare May 22, 2024 18:54
- 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.
@cmpadden cmpadden force-pushed the docs/mdx-component-to-markdoc branch from 97ca067 to 537c67e Compare May 22, 2024 19:04
@cmpadden cmpadden self-requested a review May 22, 2024 19:04
Copy link
Contributor

@cmpadden cmpadden left a 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 🙏

@cmpadden cmpadden merged commit e52e3f6 into master May 22, 2024
1 of 2 checks passed
@cmpadden cmpadden deleted the docs/mdx-component-to-markdoc branch May 22, 2024 19:09
danielgafni pushed a commit to danielgafni/dagster that referenced this pull request Jun 18, 2024
## 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dagster-university Related to Dagster University area: docs Related to documentation in general
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants