question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use Frontmatter for imports.

See original GitHub issue

Really awesome project. I think makes sense to separate imports from markup. One way to do this would be to use frontmatter – a concept made popular by Jekyll and a few other projects.

---
import: { Chart } from '../components/chart'
---

# Here's a chart

The chart is rendered inside our MDX document.

<Chart />

I wonder if anyone else has thoughts on this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jxnblkcommented, Aug 29, 2018

FWIW we decided against using front matter early on. I was originally in favor of it, but now think that MDX is much better without it. That said, it’s not too difficult to set up your own custom loader in front of the mdx-loader if you want to use front matter in your project, as is done here https://github.com/c8r/x0/blob/master/lib/mdx-fm-loader.js

0reactions
silvenoncommented, Aug 29, 2018

Yeah, I don’t see a need for this either. That would be a new synax we’d need to implement and parse without a clear benefit. Import/export takes care of everything already, which is also a standardized syntax, like YAML.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frontmatter - MDX
This guide explores how to support YAML frontmatter in MDX. ... and dynamic alternative to frontmatter, namely ESM ( import / export )....
Read more >
node.js - How to import Frontmatter & Markdown in JavaScript ...
Here is my simple JavaScript test: import home from '../pages/home.md'; console. log('testing'); console. log(home);
Read more >
Customizing input and output - Python Frontmatter
loads , frontmatter first needs to figure out the best handler for the format you're using (YAML, JSON, TOML, etc), then call methods...
Read more >
Importing markdown that has frontmatter : r/logseq - Reddit
We use it in Obisidian, either Frontmatter or the note's body.
Read more >
Adding Metadata Using Markdown Frontmatter in NextJS
Once processed, the frontmatter will be available in .data.frontmatter on the vFile that was passed to the processor. import unified from " ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found