-
Notifications
You must be signed in to change notification settings - Fork 110
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
Ignore front-matter #109
Ignore front-matter #109
Conversation
…it doesn't appear in the output
e04eb93
to
c19198b
Compare
renderer/render-markdown.js
Outdated
.use(fixHeadings) | ||
.use(fixCheckListStyles) | ||
.use(slug) | ||
.use(...frontmatter(opts.ignorefrontmatter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you perhaps use Object.assign()
instead of the splat? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it can be polyfilled with just Object.assign
(it uses apply
under the hood) in this case. I will just refactor it not to use splat at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I just did some checking. GitHub actually doesn't strip front-matter but renders it as a nested table. But only if YAML syntax is used. If the front-matter is TOML or JSON style it just renders it like regular text. vmd should behave the same, if possible. We can strip it (i.e. not render it) and also add support for TOML and JSON but those behaviors should be turned off by default and can be enabled through config parameters / command-line arguments. I tried some front-matter that I copied from the hugo docs. YAML:
Is rendered like this: TOML-syntax front-matter is just rendered as text:
Looks like this: Same with JSON-syntax front-matter:
Looks like this: Invalid YAML front-matter is rendered like this: |
I've created a new issue based on my comment. |
@pavloo : I'm not sure if you got the notification emails as it happened in a different issue. But I made a couple changes to the Front Matter behavior in PR #112:
|
@maxkueng Sorry was on vacation. Looks nice. Thanks! |
Currently
vmd
tries to parse front-matter as it's a valid markdown. This PR adds a feature of ignoring front-matter. By default it's configured to ignore yaml front-matter, but there is an option to set the list of ignored formats.