-
Notifications
You must be signed in to change notification settings - Fork 863
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
Gruber dialect parses content between two tight hr's incorrectly. #106
Comments
The content should be rendered into something like:
So that's definitely a bug that needs to be looked into. The default (Gruber) dialect doesn't support any metadata. The Maruku dialect should support metadata, but it's in a different format. The format you have looks like front-matter. If so, the YAML block would need to be stripped from the document before it's passed to markdown-js to be parsed. |
To expand on Dom's suggestion, here is an example of how to use the Maruku dialect: var markdown = require('markdown').markdown;
var content = fs.readFileSync(filepath, 'utf8');
var jsonML = markdown.parse(content, "Maruku");
// You might want to add some sanity checking to make sure that attrs is not a
// string or an array - that would signal no document metadata.
var attrs = jsonML[1];
var htmlContent = markdown.toHTML(jsonML);
// You can now look at attrs.title, attrs.layout etc. |
@evilstreak Thanks - that text is the frontmatter - i am working on a static-site-generator since wintersmith/docpad dont meet my needs and require too much pre/post processing. I think I can use Maruku dialect for that. @ashb Thanks for that tip - saved me a lot of time |
The stuff between "---" in the headers is not getting rendered - only horizontal lines are created
Why does this occur? Does this automatically convert the stuff into some kind of meta-data? Example below:
Output is like:
The stuff between the first two hrs is missing for some reason I do not understand. Is it considered as document metadata?
I've also posted the same question on stackoverflow:
http://stackoverflow.com/questions/18007857/markdown-rendered-incorrectly-with-npm-markdown
The text was updated successfully, but these errors were encountered: