-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 save/get metadata? #260
Comments
This is not part of a markdown parser usually. |
the bit at the top is YAML so you need a yaml parser |
@timaschew @tivie Thanks! I built |
I've decided that a simple metadata parser would be useful in markdown documents. The syntax is:
like this: ---
title: document title
some meta name: some meta content
---
# my markdown document
rest of the document or «««
title: document title
some meta name: some meta content
»»»
# my markdown document
rest of the document or even this: ---FORMAT-IDENTIFIER
title: document title
some meta name:
- a list
- of values
---
# my markdown document
rest of the document To enable metadata parsing, one must enable the option var conv = new showdown.Converter({metadata: true}); Showdown will expose a method for retrieving the document's metadata after parsing: var conv = new showdown.Converter({metadata: true});
var html = conv.makeHtml(someMd);
var metadata = conv.getMetadata(); // returns an object with the document metadata Note that showdown won't support YAML (or any other data format) out of the box, but you can retrieve the raw metadata and parse it yourself. var conv = new showdown.Converter({metadata: true});
var html = conv.makeHtml(someMd);
var metadata = conv.getMetadata(true); // returns a string with the raw metadata
var metadataFormat = conv.getMetadataFormat(); // returns the format of the metadata
// do stuff with the metadata var |
This feature should be implemented now
|
I'm looking how to save/read metadata like below:
--- Title: My awesome markdown file Author: Me Scripts: - js/doStuff.js - js/doMoreStuff.js ... ##Header Regular text and stuff goes here.
The text was updated successfully, but these errors were encountered: