marked icon indicating copy to clipboard operation
marked copied to clipboard

Markdown flavors + options

Open joshbruce opened this issue 6 years ago • 3 comments

Marked version: 0.3.19

Markdown flavor: all

Proposal type: other

What pain point are you perceiving?

How many licks? and too many flavors.

Right now Marked supports, in theory, the following flavors and specifications:

  1. Original (pedantic, Perl - for download here)
  2. CommonMark
  3. GitHub Flavored Markdown (really CommonMark with some extensions)

Marked only allows choosing flavors through the options in the following manner, in theory:

  1. Original (??): { pendantic: true, gfm: true|false }
  2. CommonMark (??): { pedantic: false, gfm: false }
  3. GFM (default): { pedantic: false, gfm: true }

By default, Marked uses GFM. Having said that, there are options to turn off functionality afforded by GFM ({ tables: false }). There are also features and capabilities that go beyond the specifications and help improve the quality of the HTML output ({ xhtml: false }, for example). The Marked default language prefix is not spec-based (looks like it was chosen based on another tool), should be language- not lang-; this assumes that someone should be able to replicate the spec as much as possible without changing any settings, which could help new users understand the mapping between the spec and the code.

What solution are you suggesting?

This is more about conversation and discussion about the remainder of 0.x and the no known issues target. See #1218

My immediate thought would be to possibly change options a bit.

{ 
  pedantic: true|false,
  gfm: true|false,
  commmonmark: true|false
}

This does open up a can of worms as flags are wont to become when used excessively. Therefore, believe stringifying the flavor can help:

{ 
  flavor: gfm|commonmark|cm|daring
  pedantic: true|false,
  gfm: true|false
}

...that's as far at my brain has gone so far.

joshbruce avatar Apr 16 '18 20:04 joshbruce

I would think most users would expect commonmark compliance therefore gfm and pedantic should be options but the default would be commonmark

UziTech avatar Apr 16 '18 20:04 UziTech

Having pedantic and gfm as flags still runs into the same issue of cross-flagging and could add some bloat to the code to account for it. Maybe:

{
   flavor: commonmark|gfm|daring
}

From a UX perspective, trying to take the cognitive load off the user. Seems most of our users are thinking GFM is the default. (Note: I haven't gone through all the options yet to figure out what they do exactly, will definitely try to before we get much closer to 1.x.)

Note: Looking to deprecate the flag entirely.

joshbruce avatar Apr 16 '18 20:04 joshbruce

Somewhat related, I'm going to be using this to render for reddit posts, so options like this would be super useful.

jhpratt avatar Apr 18 '18 05:04 jhpratt