Skip to content

Access frontmatter after compile with outputFormat: "function-body" #2468

Answered by wooorm
openscript asked this question in Q&A
Discussion options

You must be logged in to vote

That’s what vfile-matter indeed does!
compile indeed returns a vfile, with the compiled javascript as a result.
It also accepts a vfile, with the input markdown/mdx (with/without frontmatter).

You can put vfile-matter in a plugin, and pass that to compile. Then you get what you want too.
Or you can create a vfile first, call vfile-matter with that file, and pass that file to compile. That’s what I’d do.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@wooorm
Comment options

@remcohaszing
Comment options

@openscript
Comment options

@wooorm
Comment options

Answer selected by openscript
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants