[Plugin] Adding data to the 'import' like remark-frontmatter #2524
-
The Here's what I've tried, to no avail:
I thought that by creating a custom export like this, it'd work, but that doesn't seem to be the case. What am I doing wrong/how can I achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Welcome @mattoni! 👋 |
Beta Was this translation helpful? Give feedback.
-
That’s not what
This is very possible. Why not ask for this?
I’d like to hear what else you are using because
You’re doing several things “wrong”, or more nicely worded: several things can be improved ;) I can help you better if you provide exact input MDX, and show exact output MDX/JS/HTML. I don’t know exactly what you want. Did you see https://mdxjs.com/docs/extending-mdx/#list-of-plugins? Go through those projects, particularly the ones close to what you want to do. Their code will improve your understanding! |
Beta Was this translation helpful? Give feedback.
-
I think you’re looking to largely recreate ast.children.unshift({
type: 'mdxjsEsm',
value: '',
data: {
estree: {
type: 'Program',
sourceType: 'module',
body: [
{
type: 'ExportNamedDeclaration',
specifiers: [],
declaration: {
type: 'VariableDeclaration',
kind: 'const',
declarations: [
{
type: 'VariableDeclarator',
id: { type: 'Identifier', name },
init: valueToEstree(data, { preserveReferences: true })
}
]
}
}
]
}
}
}) You need to specify |
Beta Was this translation helpful? Give feedback.
I think you’re looking to largely recreate
remark-mdx-frontmatter
, notably this part:You need to …