JSX + Markdown

# General

General Chatter

Trending conversations
Should literal <h1> be contained in a <p>
@sscotth · 5d
Charge - new SSG that accepts mdx
@bz · 3d
How do I install a remark plugin in Parcel
@leifriksheim · 6d
Traversing MDX components
@aroncarroll · 7d
How do I add plugins top gatsby-mdx?
@jesse-graphcms · 14d

Transclusion of TypeDoc / component-generated markdown

John Whitley (@jwhitley) · January 30, 2019 at 5:42pm

Transclusion of TypeDoc / component-generated markdown

January 30, 2019 at 5:42pm

I'm interested in writing a component that pulls in TypeDoc-generated markdown from a source file into an mdx file. Is this currently feasible in mdx? If so, I'd love some pointers to get me going in the right direction. I've been dredging the issues to gauge this, and some old discussion suggests that this wasn't possible at one time.

The simplest process to my end goal looks to be via Markdown file transclusion, with an intermediate build step to transform the TypeDoc source files into .md. It would be nice if our MDX docs could skip that with a custom component, say SourceDoc, e.g.:

# This is a document!
Lorem ipsum yada yada ...
# APIs
<SourceDoc file="../path/to/source.tsx" />
# Other Commentary

My first take is to have a look at how Markdown transclusion works and see if I can reuse the approach(es) employed there.

Last but not least, the rationale for this approach is that most of our docs are "native" mdx (via docz), but there are cases where we'd like to cherry pick inline API docs into our documentation.

March 14, 2019 at 6:35pm

@jwhitley is MDX based and may fit your use case.

  • reply
  • like

Toward specifically transcluding docs, it should be possible using a React component that grabs pre-generated tsdocs, or to programmatically generate TSDocs and render TSDocs to the page.

  • reply
  • like and may offer some ideas on where to get started creating a component that can integrate TSDoc directly.

  • reply
  • like