Skip to content

MDX Children #1954

Answered by ChristianMurphy
sswatson asked this question in Q&A
Feb 27, 2022 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

It seems my options are to write JSX (which is unfortunate since MDX is more convenient)

Could you expand what you mean by this?
MDX is Markdown and JSX, either can be used in this context.

Some ways to do interleaving:

JavaScript tagged templates

Using https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates to treat the content of the template string as markdown or MDX content.
Which could look something like:

# Exercises

What's 1 + 1?

<MultipleChoice
  options={[{
      answer: 2,
      response: mdx`*Nice!*`
    },{
      answer: 3,
      response: mdx`**Too** big!`
    }
  ]}
/>

Using declarative JSX components, with Markdown children

U…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sswatson
Comment options

@ChristianMurphy
Comment options

@sswatson
Comment options

Answer selected by sswatson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants