react-showdown icon indicating copy to clipboard operation
react-showdown copied to clipboard

How to get metadata?

Open GSoftwareDevelopment opened this issue 3 years ago • 3 comments

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?

GSoftwareDevelopment avatar Jan 04 '21 12:01 GSoftwareDevelopment

Does anyone look here?

GSoftwareDevelopment avatar Mar 14 '21 12:03 GSoftwareDevelopment

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?

jerolimov avatar Mar 22 '21 10:03 jerolimov

Yes. I want access to that metadata.

GSoftwareDevelopment avatar Mar 23 '21 09:03 GSoftwareDevelopment