Transclusion of _inline_ markdown?
See original GitHub issueHi. Markdown file transclusion (MFT) is super cool, but I cannot find a way to do the equivalent when all of the markdown is defined in the same file. Something like:
// page.mdx
import FancyLayout from '../components/FancyLayout
# Title
[1] Parsed _markdown_ content
<FancyLayout>
[2] More parsed _markdown_ content, in a fancy layout
</FancyLayout>
I would like [2]
to be parsed as markdown, but not sure how, beyond defining it in a separate file and using MFT. I’d like to keep it all in one file, though, for the sake of non-technical authors. Do I need to somehow make FancyLayout an MDX-savvy component?
If it’s relevant, I’m using gatsby-mdx on a brand-new gatsby-starter-default.
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:36
- Comments:22 (10 by maintainers)
Top Results From Across the Web
Transclusion or including sub-documents for reuse - Extensions
I have implemented this in a code documentation tool I'm writing, with the following syntax: {{ my_file }} -> include the file and...
Read more >Zettelmarkup: Inline-mode Transclusion - Zettelstore
Inline-mode transclusion applies to all zettel that are parsed in a non-trivial way, e.g. as structured textual content. For example, textual content is ......
Read more >Simpler transclusion syntax - Feedback | Docusaurus
Embed a markdown file content into your current document. ... Simpler transclusion syntax ... It would be nice if one could import a...
Read more >Better export inline transclusions? - Obsidian Forum
Is there any way I can make the inline transclusion take less space? This would help make the page more concise and print...
Read more >jamesramsay/hercule: Simple document transclusion, ideal for ...
Hercule extends the Markdown inline link syntax with a leading colon ( : ) to denote the link should be transcluded. The content...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What if mdx exported a function that took in mdx-friendly syntax (as a string, I assume) and output parsed content. Then a consumer could make a component using that function and include it:
Of course, that MDXParser (name tbd) could then be integrated within FancyLayout, for a better authoring experience.
For simplicity, you could also restrict MDXParser from allowing imports/exports (at least for my use case).
It appears that all of us forgot to check if that syntax actually works in MDX 🤣
It appears that it does, please confirm if this is what you wanted.