carbon-design-system / carbon-platform

The "next" version of the Carbon Design System website, as a platform.
https://next.carbondesignsystem.com
Apache License 2.0
21 stars 5 forks source link

Scrub remote MDX content to remove imports and unsupported MDX components #692

Closed mattrosno closed 2 years ago

mattrosno commented 2 years ago

Take the test page a step further by using a file that has unsupported MDX components that need scrubbed out prior to rendering. Same with imports that need removed. See remote MDX library constraints. Consider using React error boundaries to catch MDX rendering errors.

E.g.: https://github.com/carbon-design-system/carbon-website/blob/main/src/pages/components/accordion/usage.mdx

Example of imports that we need to discard: https://github.com/carbon-design-system/carbon-website/blob/main/src/pages/components/dropdown/usage.mdx

mattrosno commented 2 years ago

Hey team! Please add your planning poker estimate with ZenHub @alisonjoseph @andreancardona @francinelucca @jdharvey-ibm

mattrosno commented 2 years ago

MDX content -> AST (abstract syntax tree) -> filter out nodes that we don't want -> return response.

mattrosno commented 2 years ago

Also investigate options to parse MDX.

francinelucca commented 2 years ago

Closing, not doing this as per technical design: https://github.com/carbon-design-system/carbon-platform/issues/952