Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get metadata? #63

Open
GSoftwareDevelopment opened this issue Jan 4, 2021 · 3 comments
Open

How to get metadata? #63

GSoftwareDevelopment opened this issue Jan 4, 2021 · 3 comments

Comments

@GSoftwareDevelopment
Copy link

GSoftwareDevelopment commented Jan 4, 2021

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
Copy link
Author

Does anyone look here?

@jerolimov
Copy link
Owner

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?

@GSoftwareDevelopment
Copy link
Author

Yes. I want access to that metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants