Docusaurus: Embed React components in docs markdown?

Created on 7 Mar 2018  路  7Comments  路  Source: facebook/docusaurus

# MyTite
Hello

## MySubtitle
Hello

<react>
    <MyComponent prop1={} prop2={}/>
</react>

Is this a bug report?

No.

Have you read the [Contributing Guidelines on issues]

Yes

Environment

N/A

Steps to Reproduce

N/A

Expected Behavior

N/A

Actual Behavior

N/A

Reproducible Demo

N/A

advanced feature v2

Most helpful comment

Would love to see MDX support like in Docz

All 7 comments

FYI.

Here's what a quick hack (static React Styleguidist build with custom template, the .html page moved to /pages and the .js files moved to /static/js) looks like.

Everything but the code editor works right off the bat. The editor isn't properly loaded because the require inside the bundle file is wrong still.

styleguidist

Not sure if that would be an option or if React Styleguidist is too heavy a dependency.

It does add some niceties, like the aforementioned editor (provided I can get it to work).

EDIT: Correction. All the editor needed was one more <script> line in the template.
Not yet sure how to deal with the bundle names, though. Since they appear to be versioned in some way (bundle.c4f94f29.js and 0.4a3876a7.js, in my case).

EDIT2: In case it wasn't obvious. This depends on wrapPagesHTML: true, naturally.

@Happy-Ferret Cool! So if we integrate ReactDown, we could get this going, you think?

Not sure about ReactDown. I was using StyleGuidist for my little PoC.
I have no experience with ReactDown. Only found out about it and thought it might be an option, too.

ReactDown is static though, from what I can gather. No live editing capabilities.

Would love to see MDX support like in Docz

Maybe in the future 馃槉

mdx-docusaurus

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nebrelbug picture nebrelbug  路  3Comments

lex111 picture lex111  路  3Comments

endiliey picture endiliey  路  3Comments

microbouji picture microbouji  路  3Comments

rickyvetter picture rickyvetter  路  3Comments