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

Add dependencies to be able to render/compile MDX files into pages #1085

Closed
wants to merge 2 commits into from

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Jun 6, 2023

Very rough and early proof of concept on being able to write documentation pages in MDX.

It lacks:

  • Proper styling. Generated elements do not have all the tailwind classes, but that can be addressed by adding custom components to the MDXProvider:
    <MDXProvider
      components={{
        h1: props => (
          <h1 className="text-3xl text-slate-600 font-bold" {...props} />
        ),
        // ...
      }}
    >
      
    </MDXProvider>
  • Support for advanced components, like the Library.Demo component. In an ideal world, we should be able to map pre or code to it via the same approach above, but I'm sure there will be some challenges.
  • Proper types for mdx components. Supposedly adding @types/mdx should do, but TS is currently complaining about importing mdx files

This PR also provides two different approaches to use MDX in docs:

  • Writing the whole doc as a single markdown file
    • 🟢 Allows you to abstract away from target "platform" when writing docs.
    • 🟢 Makes it easier to read individal doc pages.
    • 🔴 Requires further MDXProvider components configuration to support all requirements from current structure.
    • 🔴 Requires accepting some limitations and adapting the mental model.
  • Continue explicitly using Library components (Section, Pattern, etc), and using small pieces of markdown in between
    • 🟢 Covers the purpose of reducing the awkwardness of manually writing paragraphs, code blocks, escaping characters, etc, without having a major impact on how docs are structured
    • 🟢 Requires less customization of the MDXProvider.
    • 🔴 Might be harder to read as a whole, specially when reviewing a PR, where you want to focus on the content and not the structure.
  • Something in between.
    • We don't have to choose one or the other. It is always possible to delegate some structural decisions to something outside doc pages themselves, likeLibrary.Page or Library.Section, while we still explicitly use components like Library.Example or Library.Code.

This PR relates to #1067

@acelaya acelaya requested a review from lyzadanger June 7, 2023 07:43
@lyzadanger
Copy link
Contributor

Hi @acelaya ! Just a confirmation that "I see this!" Thanks for looking into this a bit. I'll review when I have some spare brain and time cycles!

@lyzadanger lyzadanger removed their request for review June 7, 2023 18:16
@acelaya acelaya force-pushed the mdx-documentation branch from 061e168 to 0e56581 Compare June 8, 2023 12:31
@lyzadanger
Copy link
Contributor

Hi @acelaya : I was wondering if there might be another way of persisting this concept and what you learned that is not a PR. I do want us to get back to it but it might be a while.

@acelaya
Copy link
Contributor Author

acelaya commented Jul 5, 2023

Hi @acelaya : I was wondering if there might be another way of persisting this concept and what you learned that is not a PR. I do want us to get back to it but it might be a while.

The options I can think of:

  • Just close the PR. GitHub will keep it around and it's still referenced from the issue, so we can come back to it eventually.
  • Close the PR, but move some of the info in the description to a comment in the issue.

@lyzadanger
Copy link
Contributor

Hi @acelaya : I was wondering if there might be another way of persisting this concept and what you learned that is not a PR. I do want us to get back to it but it might be a while.

The options I can think of:

  • Just close the PR. GitHub will keep it around and it's still referenced from the issue, so we can come back to it eventually.
  • Close the PR, but move some of the info in the description to a comment in the issue.

I'll let you decide! Whatever you prefer.

@acelaya
Copy link
Contributor Author

acelaya commented Jul 5, 2023

Closing this for now, until we have more capacity to come back to it.

@acelaya acelaya closed this Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants