If you take an `*.mdx` file and run it through a typical markdown renderer, you'd get something like... well... lemme give the counter-example: if you had the "dashes" delimiting your "frontmatter" from the document, you'd get something like:
<hr>import foo, bar, baz<hr>\n<h1>Markdown</h1><ul><li>...etc...
...the critical part being to relatively unambiguously demarcate "junk" from "content" in the markdown ecosystem. In the far future when this project is but a forgotten memory of time, people can still just straight up render the markdown and "obviously" delete the stuff between the <hr's> up at the top.
The contrarian is that there's ambiguity as to when your `*.mdx` "import junk" stops and when the actual content starts. Do you stop parsing [for imports] after the first blank line? Do you stop parsing when you get a syntax error? Do you only parse lines that begin with [import ...]? What about [from ... import ...]?
...strong recommendation: demarcate "headers" from content (a-la HTTP). Your format effectively becomes `---\n $PROG_LANG_GOES_HERE ---\n $CONTENT_HERE`, and you slide 1000% into "pure HTTP":
GET /foo.mdx
Content-Type: application/mdx
Date: 2020-10-10 01:02:34
---
import SomeComponent
---
<SomeComponent>My Header</SomeComponent>
* Some
* Content
I actually previously used Jekyll! Built this largely because I want full React component functionality sometimes. Also I think Jelyll gave me some issues with routing that I didn’t like.
You’re getting close. The biggest thing is that I want to be able to use React components sometimes and anywhere on the page. If you just want md -> html, there are of course much better options.
Precisely! Thank you.
Can you share more about what you have in mind for frontmatter? I don’t really understand the need/use cases yet.