react-showdown
react-showdown copied to clipboard
How to get metadata?
How to get metadata using React component? An example is given in the documentation:
var conv = new showdown.Converter({metadata: true});
var html = conv.makeHtml(someMd);
var metadata = conv.getMetadata(); // returns an object with the document metadata
However, I am using the library in the context of the React component:
import MarkdownView from "react-showdown";
<MarkdownView ... />
And here is the title question. How to get metadata from Showdown Rect? Is it even possible?
Does anyone look here?
Do you mean frontmatter data like
---
title: Hello world
---
content
You can already hide these data from rendering with the option prop:
import MarkdownView from "react-showdown";
<MarkdownView options={{ metadata: true }} ... />
Do you want also access these data, for example the title, in your markdown or in some custom sub-components?
Yes. I want access to that metadata.