-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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: Improve MDX new user experience #2505
Comments
Hey @karlhorky! 👋 A few themes I'm hearing from you (correct me if I repeat these back inaccurately)
A few themes I'll share from my perspective before responding more in depth
Hindsight being 20/20 this feels like it could/should have been made an absolute path instead of a relative path so it would resolve the same anywhere?
Not judging, just observing. More documentation won't help people that don't read documentation in the first place. 😅
As you move from the higher level abstraction to lower level ones for more advanced use cases it does get more complex.
Could you expand what you mean by this?
Unified has a large API surface. If you need help typing your own custom plugins, we have recipes at https://unifiedjs.com/learn/ which offer some best practices for working with the typings, which maintain strong type guarantees.
If you have concrete suggestions on common use cases you see beyond content ideas are welcome!
We have this! https://unifiedjs.com/learn/
I land pretty strongly against example folders like this, they aren't maintained and tested the way they should be, and that can cause more confusion that it can help (see Incorrect documentation is worse than no documentation above)
This is great in theory but doesn't happen in practice (see MDX is Stadium project above) Even when contributions trickle through, they don't necessarily follow the best practices of the project.
This is a good example of why this is challenging.
I interpret this as meaning canary testing.
I still don't know what interop problems you are referring to.
We don't have a marketing team to go SEO chasing.
There is some linking between sites already.
I don't understand this comment.
Unified and all the umbrella projects have a large API surface, just versions doesn't communicate necessarily have enough information to communicate if they are compatible or not. For that finer grained reporting we have TypeScript typings, which report when and where things mismatch.
That is what https://github.com/mdx-js/mdx-analyzer is here for, and it grows in capabilities regularly. (as you are aware regularly contributing issues)
This would be a great thing to raise with the Next team who manage the Next integrations
Contributions to get intelligent search working again are welcome #1776 I don't think the team has the budget or interest in running a full LLM chat bot for the MDX docs (with July 2024 LLM cost and capabilities anyway). |
Thanks for sharing your thoughts! Here are some responses to different parts. There’s a lot. Sometimes duplicated. So I haven’t responsed to everything. Let me know if there’s something I’m missing.
Given that the That MDX 2 release was big. I don’t see MDX change much ever again.
I think this fundamental: MDX is not HTML. It isn’t markdown + HTML. If you want that, use markdown itself Making websites is complex; compilers are complex.
What’s that joke? PEBCAK 😅
Right, reiterating what I said above: how to use Coming back to your earlier “User would like to import the .mdx file in another location. "abc.mp4" cannot be resolved anymore.” Answer that first. You don’t need all these plugins. Write it: import myVideoSource from './some-video.mp4'
<video src={myVideoSource} controls />
I don’t fully understand, can you explain?
I don’t think these use cases are that simple or that they have that much to do with MDX.
This is incredibly hard to keep up to date. I’m betting it costs Vercel tons, millions, to maintain that.
Please raise these issues when you encounter them? I don’t know them.
unifiedjs.com has all the readmes. Still, it’s more than 500 readmes.
I think this makes more sense as a separate issue where you explain what is going on for you.
This sounds like something on top of MDX: I think there’s lots of room above MDX for more site builder like tools.
I’m going to move this to a discussion. There’s lots of room for issues, but issues can be closed at some point. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Initial checklist
Problem
Let me start with saying MDX and the experience it enables (when properly set up + configured) is great! The simplicity and ease of Markdown with the power, flexibility and interop of React 😍
However, there are not-uncommon cases where users can fall off the happy path / miss the pit of success if going beyond the simple first examples - there's a long tail of complexity and high chance for breakage in moving beyond simple examples.
Let's take
<video>
support an MDX document in Next.js as an example:<video src="abc.mp4">
to an MDX document, knowing already that they can add HTML to MDX - it works! 👍.mdx
file in another location."abc.mp4"
cannot be resolved anymore.rehype-mdx-import-media
, using cmd-F, finds that it supportsvideo[src]
and tries configuring using the example config<video>
, user researches quickly and finds no issues or problems with the<video>
syntax. (at this point, knowledgeable, experienced MDX users would have found the bullets underUsage
, but during my user journey, I did not understand this on the first try). User instead tries out an image in Markdown syntax and it appears to be working.<video>
andrehype-mdx-import-media
, but since there are no issues directly related to this plugin, researches in related ecosystems rehype and MDX. User does not find something directly related to lack of<video>
support, but eventually finds that there may be behavior of MDX which causes it to treat HTML elements differently than Markdown elements.<video>
in MDX syntax and finds the![](abc.mp4)
syntax (which, to be fair, contains the caveat "Depending on your markdown processor,"). This doesn't work out of the box.![](abc.mp4)
syntax support and happens on to@chailotl/remark-videos
, which does help - the error message has now changed toModule parse failed: Unexpected character ''
(to be fair, this is entering Next.js + webpack territory now).mp4
files.Another example would be related to a user trying to include nested MDX content on part of a Next.js page (not a full page with
app/page.mdx
) - this could lead to A)next-mdx-remote
(not fully working with nested MDX), B)mdx-bundler
(working with nested MDX but complicated) and then C) back to@next/mdx
(which does work, but it is undocumented how to do it -await import(...)
).In my personal evaluation, after years on and off in the MDX ecosystem (having also invested more time and energy than I would say is average for a part-time user): this is not an uncommon experience when working with MDX - as soon as needs exceed the basics a bit, I've seen it be common to have a "rabbit hole"-type debugging experience, through complexity and incompatibilities on various levels.
In my personal evaluation, some of the first documentation problems I perceive relate to new user experience are:
A) Happy Path / Pit of Success
Lack of working, blessed, happy-path setup and integration suggestions for use cases beyond simple content
B) Transitive Dependency Web / Many Moving Parts
The complex web of transitive dependencies that extends from MDX to remark/rehype/recma to other unified packages like the
unist-*
packages makes it challenging for a senior engineer to understand, navigate and fix / work around incompatibilities - eg. type errors or runtime incompatibilities with remark/rehype/recma plugins and transitive dependenciesMany of these issues may be perceived by experienced developers or those working in the MDX and related ecosystems as "papercuts" or low-barrier issues, but for beginners, it can lead to hitting walls and even quitting. Even for me as an experienced developer, I often find myself spending a lot of time on something that appears to be a simple problem.
I don't intend this to be a condemnation or negative criticism of the ecosystem or packages or people involved - just trying to surface a report of the UX pitfalls for an (enthusiastic) user in the ecosystem.
Solution
A) Happy Path / Pit of Success
B) Transitive Dependency Web / Many Moving Parts
If this issue or or parts of this issue are accepted, then I'm ok with this becoming the parent "umbrella issue" to track multiple initiatives.
Alternatives
Create additional tooling to avoid the issue, such as:
mdx doctor
which will find common issues like mismatching or duplicated transitive dependencies and other setup problemsBut I think that these alternatives are complex and time-consuming to build and maintain, would not be able to effectively address all issues and would also require docs and outreach to make sure that users actually used them.
The text was updated successfully, but these errors were encountered: