Skip to content
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

Question/Feature Request? Using components in the middle of markdown text? #543

Closed
adueck opened this issue Apr 18, 2019 · 4 comments
Closed
Labels
👀 no/external This makes more sense somewhere else

Comments

@adueck
Copy link

adueck commented Apr 18, 2019

Is it possible to use an imported component in the middle of say, a markdown paragraph?

For example, let's say I wanted to make a component like this

import React from 'react'

const MultiLing = ({word}) => (
    <strong>{word.a} - {word.b}</strong>
)

export default MultiLing

And then I wanted to use it in an .mdx file like this

import MultiLing from "../components/multi-ling.js"

## Heading 

This is a paragraph and I will put my special <MultiLing word={{a: "word", b: "Wort"}} /> here.  

When it's in the middle of markdown text, the component doesn't get rendered. But it would be super awesome if it could. 🤔

@johno
Copy link
Member

johno commented Apr 18, 2019

This should be supported in v1. Do you happen to be on an older version of MDX?

Read the migration guide


image

@adueck
Copy link
Author

adueck commented Apr 18, 2019

Oops, I just realized I was using this starter package which updated to version 1 recently, and I hadn't updated yet. Thanks and sorry!

@adueck adueck closed this as completed Apr 18, 2019
@johno
Copy link
Member

johno commented Apr 18, 2019

No worries, glad it's working!

@adueck
Copy link
Author

adueck commented Apr 18, 2019

So happy it is. 😄 You guys have created something wonderful. I was really happy to find that this exists after imagining writing a bunch of site content in markdown with interactive react components interspersed. 👏 Just what I needed!

@wooorm wooorm added 👀 no/external This makes more sense somewhere else and removed 🙉 open/needs-info This needs some more info labels Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

3 participants