MDX works fine when it's just flat markdown content, but fails when there is any kind of react-style nesting or conditionals.
We should instead rely on react-aware implementation of markdown rendering, which would, most likely, be in a form of a React component.
Something that would allow opt-in to markdown rendering inside a conditional, allow accepting props, and moving some content to the nested pages.
We explicitly don't care about the "file being just a markdown document", and would rather choose a TypeScript file with a component with explicitly embedded markdown instead - with all the imports, proper type declarations, typechecks and the rest of what the ecosystem provides.