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

Improve frontmatter handling #15

Open
swharden opened this issue Nov 18, 2022 · 1 comment
Open

Improve frontmatter handling #15

swharden opened this issue Nov 18, 2022 · 1 comment

Comments

@swharden
Copy link

swharden commented Nov 18, 2022

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!

image

Suggested Behavior

  • frontmatter should not be displayed on the page
  • frontmatter title would override the default title if defined
  • additional features could be added in the future (e.g., description could add a meta element to the header)

Implementation

Note that title is currently always the filename and not user configurable at this time

md2html/main.go

Line 123 in 59e4b3b

title := filepath.Base(re.ReplaceAllString(opts.OutputFile, ""))


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 🚀

@nocd5
Copy link
Owner

nocd5 commented Dec 3, 2022

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.

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

No branches or pull requests

2 participants