How to place own transformer before gfm autolink transforms text into link? #57
-
I am using react-markdown 6.0.1 and my source code looks like this: <ReactMarkdown
remarkPlugins={[myPlugin, gfm]}
>
{source}
</ReactMarkdown>
export const attacher = () => {
return transformer;
function transformer(tree: any, file: any) {
console.log(tree);
visit(tree, '', visitor);
function visitor(node: any) {
console.log(node);
}
}
}; My Markdown looks like this: beginning  end
This behaviour is unexpected. I would expect that The fact that My questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
this isn' a valid markdown image, there is no content after title in markdown links or images.
Parsing happens first thing, and as a single step.
no, see the above on how parser plugins work.
You could write a custom parser for your custom image type.
In general if you want to adding custom content, I'd recommend using directives https://github.com/remarkjs/remark-directive ::image[alt text]{href=https://image title=example customAttr=something} |
Beta Was this translation helpful? Give feedback.
this isn' a valid markdown image, there is no content after title in markdown links or images.
Parsing happens first thing, and as a single step.
Stringifying happens last and also as a signle step.
Parsing and stringifying plugins, like remark-gfm, add functionality to the step, but don't add new steps.
no, see the above on how parser plugins work.
You could write a custom parser for your c…