apollographql/docs

MDX v2 or support for JSX-style comments

Opened this issue · 0 comments

Sorry if there is any glaring incorrectness in my recount of the issue here, I did this investigation awhile ago with @trevorblades and might not be remembering the facts exactly.

My desired outcome is to be able to use prettier + eslint to have my tooling / editor format code blocks correctly in the apollo-server repo's docs. This currently doesn't pan out due to a couple minor roadblocks that can hopefully be worked around or fixed in some way. The currently-dead-ended PR is here: apollographql/apollo-server#6914

Over there, I noted a couple potential ways to unblock:

  1. Figure a way to strip HTML comments before mdx parsing happens
  2. Print JSX-style comments correctly (i.e. don't print them) when we generate the HTML

IIRC, our current use of MDX v1 (which uses HTML-style comments) breaks current v2 tooling. So upgrading to v2 is potentially a solution.

Alternatively, we could stay on v1 if it was possible to use JSX-style comments instead. Currently, those turn up as actual text in the rendered HTML, so that's not a viable option for now (but could potentially be something we implement in the docs build pipeline, presumably, by stripping them out).