jbake-org / jbake

Java based open source static site/blog generator for developers & designers.
http://jbake.org
MIT License
1.12k stars 326 forks source link

JBake not following Markdown spec for paragraphs by default #651

Open yakoder opened 4 years ago

yakoder commented 4 years ago

This appears to be related to a long closed 'question' #159 in that the default settings for 'markdown.extensions' do not obey the very clearly specified spec for Markdown (as per JBake documentation is located at Daring Fireball. Specifically:

The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard-wrapped" text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type"s "Convert Line Breaks" option) which translate every line break character in a paragraph into a
tag.

Testing methodology (after noticing this on a real site and spending an hour researching things):

  1. mkdir test
  2. cd test
  3. jbake -i
  4. created content/test.md
  5. jbake -b
  6. examined output/test.html (Has unexpected, per spec, and unwanted
    tags
  7. mkdir test2
  8. cd test2
  9. edited jbake.properties ("test2-jbake.properties" in referenced gist) to add markdown.extensions=-HARDWRAPS
  10. jbake -b
  11. examined output/test2.html (Is as expected, per spec, at least for paragraphs. There's a few missing spaces between words, but that's a different issue (maybe).

Files on gist

As I see it, there's a few potential, acceptable, solutions to this:

  1. change the default settings to disable HARDWRAPS when calling flexmark-java
  2. change the reference of the Markdown spec to another that defines inserting a
    for every newline.
  3. add a notation in the JBake Documentation beside the link to the Markdown spec, noting that the paragraph rule about allowing hard-wrapped lines will not be followed by default, and the user should add markdown.extensions=-HARDWRAPS to their jbake.properties to get it to render paragraphs per spec.

Other info: I actually started by going through all (open and closed) issues for flexmark-java, thinking it was a bug in that project, before coming and searching here. Not sure why it was raised as only a "question" back in 2014, and then immediately closed by that reporter, since it clearly is an issue of not following markdown specifications. (They typed a whole long paragraph on this point, so it's kinda one of the more important pieces of Markdown to the language creators.)

jonbullock commented 4 years ago

Did a bit of investigation to see when this default was set, and it looks like it was defined when the project switched from MarkdownJ to PegDown. While you can easily override the default per project there is no specific reason why this default was set this way, so I don't see any reason why the default shouldn't match the original Markdown spec.