MacDownApp / macdown

Open source Markdown editor for macOS.
https://macdown.uranusjr.com/
9.44k stars 1.09k forks source link

Consider supporting multimarkdown metadata #183

Open jgclark opened 10 years ago

jgclark commented 10 years ago

This metadata specification is the first part of multimarkdown that I would like to see supported, beyond the already-supported footnotes. It seems to me that MMD metadata is (deliberately) close to the YAML that's also already supported.

uranusjr commented 10 years ago

The problem is that this seems to conflict with YAML front-matter, and you can only use one of them at a time. I will look into how support to both can be provided together.

jgclark commented 10 years ago

Given the difficulty of clashing, and the oddity of someone trying to use both methods in the same document, I think you're well within your rights to say that using both will lead to undefined results. Or better, given I could just about imagine a scenario where documents are included in others, that you say the first found method is used, and the other ignored.

On Tuesday, October 7, 2014, Tzu-ping Chung notifications@github.com wrote:

The problem is that this seems to conflict with YAML front-matter, and you can only use one of them at a time. I will look into how support to both can be provided together.

Thanks,

-- Jonathan

masukomi commented 10 years ago

Much as I love MMD, it seems clear that YAML (for better or worse) has won the collective geek mindset of how to handle frontmatter / metadata. This may just be because everyone who is using frontmatter is doing so to support a static blog, and 90% of the tools seem to have just said "yeah, it worked for Jekyll so we'll do it too." Or maybe it's just 90% of the tools I've looked at, but I've looked at a lot of them.

uranusjr commented 10 years ago

Another reason might be that YAML parsers are very easy to come by. If you go MMD style you’ll need to write your own parser, which isn’t always trivial (although it is easy enough in Objective-C for this particular case, I think).

I’m still trying to find a way to arrange preferences. Support is still possible if there’s a way to reasonably switch between the two syntaxes.

masukomi commented 10 years ago

Just to add some info to the discussion: I was just looking at the Hugo static blog tool yesterday. It supports 3 forms of frontmatter: YAML, JSON, and TOML. I'd never heard of TOML before then, but part of the draw is probably that Tom Preston-Warner is behind it.

YAML is surrounded by ---, TOML by +++, and JSON by { and }. MMD's frontmatter is --- before and --- or ... after.

Maybe the right solution is to just handle the YAML in the pretty format we currently have (because it's already written) and beef up the detection algorithm to detect other forms of frontmatter, but instead of actually trying to do pretty table things with it just display their contents as preformatted text. Then modify the preference from "Detect Jekyll frontmatter" to be a toggle that says "Display Frontmatter" which would either detect it and display it or hide it. I think detecting the fencing strategies above would handle most everything and with something robust enough to detect all of those adding another one (if someone finds one) wouldn't be hard.

jgclark commented 10 years ago

That sounds like a good suggestion, masukomi. If YAML is most prevalent, then let's make sure that continues to have the best support.

Thanks,

-- Jonathan

masukomi commented 10 years ago

on a related note. This is the related preference from Marked 2 which I didn't realize supported MMD frontmatter until I just went to look for the frontmatter preferences

otherviews_and_advanced

Not suggesting we should emulate it. Just providing "food for thought".