md2html
md2html copied to clipboard
Improve frontmatter handling
Hi @nocd5, thank you for this fantastic application!
Many people utilize frontmatter in markdown documents for keeping track of metadata. Briefly, frontmatter is key/value pairs enclosed by triple dashes at the start of a markdown file. A common example is Jekyl's frontmatter (used by GitHub Pages) which sets the page title
Current Behavior
---
title: My Site
description: A fantastic website with useful information
---
This website is build using *Markdown* and it's great!

Suggested Behavior
- frontmatter should not be displayed on the page
- frontmatter
titlewould override the default title if defined - additional features could be added in the future (e.g.,
descriptioncould add ametaelement to the header)
Implementation
Note that title is currently always the filename and not user configurable at this time
https://github.com/nocd5/md2html/blob/59e4b3bee4d2d268c7876f8c1d8b144f06fce82d/main.go#L123
What are your thoughts on this topic? If you're in favor, is this something you want me to work on and create a PR? I have very little Go experience, but this seems pretty straightforward and I think I could figure it out based on your interest and availability.
PS: consider creating a contributing.md file to signal whether or not contributions are invited
Thanks again for this fantastic little app 🚀
Hi @swharden, thanks for the issue and sorry my reply is late.
I've never known frontmatter. I hope the PR! And found yuin/goldmark-meta. md2html has been used yuin/galdmark as markdown parser from v2. So, I think fit to use it.
Maybe we need discussion about title for case of
converting from multiple markdown to one html.
like this md2html in1.md in2.md -o out.html
Although too personal matter to talk here, We have been given little twin at last year, so it's difficult to find my time for coding. Please accept delay in my response.
Thanks.