realworldocaml/mdx

integration with jsx?

Opened this issue · 2 comments

In a recent discussion, someone brought up the question of how easy it would be to extend ocaml-mdx to be able to sync snippets into a react javascript file with embedded jsx, possibly using javascript comment syntax instead of html comment syntax. Curious to hear your estimate of effort? This is all very speculative, low priority

I'm not sure I understand what you're suggesting, could you provide a small example of what you would like mdx to do, which file would you use as its input and so on?

Imagine a React based static site implemented with GatsbyJS or similar, with a page like the following:

function AboutPage () {
   return (
      <div>
        <p> some text </p>
        </p> more text </p>
        { /* $MDX file=sync_to_md.ml,part=partName */}
     </div>
   );

Then having ocaml-mdx be in charge of injecting <pre> .... ocaml snippet </pre> for that file.