Ticket UUID: | 5b8e3a9e9bb8a12fe4d0b2755086c1c241390bc | |||
Title: | In package Markdown when a header markup is used (#, ##, ###, ####) it encloses the next line in the html header output unless their is a blank line below it. | |||
Type: | Bug | Version: | 1.19 | |
Submitter: | LawrenceWoodman | Created on: | 2018-06-05 13:33:49 | |
Subsystem: | markdown | Assigned To: | aku | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2021-09-18 10:53:15 | |
Resolution: | Fixed | Closed By: | aku | |
Closed on: | 2021-09-18 10:53:15 | |||
Description: |
In package Markdown when a header markup is used (#, ##, ###, ####) it encloses the next line in the html header output unless their is a blank line below it. The following code demonstrates this: package require Markdown set cases { {in { # This is a title this isn't } want {<h1>This is a title</h1> <p>this isn't</p>} } {in { ## This is a title this isn't } want {<h2>This is a title</h2> <p>this isn't</p>} } {in { ### This is a title this isn't } want {<h3>This is a title</h3> <p>this isn't</p>} } {in { #### This is a title this isn't } want {<h4>This is a title</h4> <p>this isn't</p>} } {in { # This is a title this definitely isn't } want {<h1>This is a title</h1> <p>this definitely isn't</p>} } {in { ## This is a title this definitely isn't } want {<h2>This is a title</h2> <p>this definitely isn't</p>} } {in { ### This is a title this definitely isn't } want {<h3>This is a title</h3> <p>this definitely isn't</p>} } {in { #### This is a title this definitely isn't } want {<h4>This is a title</h4> <p>this definitely isn't</p>} } } set caseNum 0 foreach case $cases { set got [::Markdown::convert [dict get $case in]] if {$got ne [dict get $case want]} { puts stderr [format \ "\n(%2d) Markdown::convert got: {$got}, want: {[dict get $case want]}" \ $caseNum ] } incr caseNum } | |||
User Comments: |
aku added on 2021-09-18 10:53:15:
Merged, commit [7aa9b7bc26]. aku added on 2021-09-18 09:04:45: Confirmed issue with extended test-suite supplied by Torsten. Confirmed that Torsten's changes fix the issue, extended test-suite passes again. Done with commit [93fd3ad0a8], on a branch, with thanks to Torsten. Branch to be merged ASAP. Still have to go and run the complete testsuite. torstenberg added on 2021-09-17 13:46:45: Here is a fix attached. I have put the relevant cases of the OP into the markdown.test also and they pass, as well as all the other tests. I also added a test with some markdown from Gruber'S original markdown description. torstenberg added on 2021-09-15 11:09:44: This is in essence about adding a blank line between the header and the following content or not. The module only parses correctly when a blank line is present. The original markdown definition does not specify this requirement, but the associated markdown implementation (Markdown.pl from Gruber) matches an ATX header on one single line, i.e. the header cannot span more than one line (while the SETEXT headers can). After the single heading line, other content can thus follow, e.g. a paragraph or a list. This is in line with the current commonmark specification (0.30) which says "ATX headings need not be separated from surrounding content by blank lines, and they can interrupt paragraphs". So, the tcllib implementation is too strict here. I have a patch for this ready which I will give a bit more testing (to make sure it does not interfere with other markup) and then submit here. aku added on 2018-07-09 19:21:57: Sean, can you look into this, please ? This might have to be reported to Caius as well. Or maybe a fix ported over if they already have one. |
