View Issue Details

IDProjectCategoryView StatusLast Update
0022333mantisbtmarkdownpublic2017-04-01 00:13
Reporterj_schultz Assigned Tojoel  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1.0 
Target Version2.2.3Fixed in Version2.2.3 
Summary0022333: Markdown starts heading in the middle of a line
Description

A hash character should only start a heading if it's found at the beginning of a line, but not like here:

  1. #example text
  2. test
TagsNo tags attached.

Relationships

child of 0022180 new Markdown issues following implementation in 0017920 

Activities

j_schultz

j_schultz

2017-02-14 09:50

reporter   ~0055672

This should probably also be a child of 0022180?

joel

joel

2017-02-27 09:58

developer   ~0055795

I don't think this would be a big issue, because github behave the same as it is.

joel

joel

2017-02-27 09:59

developer  

j_schultz

j_schultz

2017-02-27 10:02

reporter   ~0055796

What is the markup that you used? Neither 1. #test nor 1 #test creates a heading on Github, but it does on Mantis.

j_schultz

j_schultz

2017-02-27 10:10

reporter   ~0055797

Reopening because allowing a heading to start at the start of an enumeration item is both semantically wrong and is not identical to what Github does.

j_schultz

j_schultz

2017-02-27 10:10

reporter  

github-headline.png (3,540 bytes)   
github-headline.png (3,540 bytes)   
joel

joel

2017-02-27 10:33

developer   ~0055798

Last edited: 2017-02-27 10:37

This I entered on github

1. # example text
2. test
j_schultz

j_schultz

2017-02-27 10:50

reporter   ~0055800

This is not identical to my example, see above (there is an extra space in your example). My example can easily break the formatting of discussions about programming languages that make use of the "#" character at the start of a line, such as the C preprocessor (think of something like "#define" or "#include").

joel

joel

2017-02-27 11:29

developer   ~0055801

Last edited: 2017-02-27 11:47

I got now your point @j_schultz, Thank you for clarifying your concern of the issue. I will add custom logic for this.

joel

joel

2017-02-27 17:46

developer   ~0055810

Last edited: 2017-02-27 19:26

This is a bug in upstream, no need to fix on our side. For this, I will open a ticket on the issue in github. https://github.com/erusev/parsedown/issues/479

dregad

dregad

2017-02-28 04:19

developer   ~0055816

Last edited: 2017-02-28 04:21

Reading the discussions in the upstream issue tracker, I get the feeling that this issue won't get fixed anytime soon [1], so I would suggest implementing a workaround on our end (e.g. [2]).

[1] see https://github.com/erusev/parsedown/issues/265, and particularly parsedown author's comment https://github.com/erusev/parsedown/issues/463#issuecomment-273702303
[2] https://github.com/erusev/parsedown/issues/463#issue-201604127

joel

joel

2017-03-01 09:12

developer   ~0055839

Last edited: 2017-03-12 18:47

PR https://github.com/mantisbt/mantisbt/pull/1043

Related Changesets

MantisBT: master-2.2 e4c0cceb

2017-03-06 09:02:29

Joel C. Llano


Committer: dregad Details Diff
Fix Markdown handling of # characters

- remove incorrect logic to identify headers
- ensure header detection abides by the CommonMark spec rules [1]
- remove isBugLink method, which is no longer needed since bug links
(i.e. `#number`) are not recognized as a header by the new regex

Fixes 0022333

[1] http://spec.commonmark.org/0.27/#atx-headings

Signed-off-by: Damien Regad <dregad@mantisbt.org>

Changes to Joel's original code: squashed 2 commits, reworded commit
message as well as the comments within the code.
Affected Issues
0022333
mod - plugins/MantisCoreFormatting/core/MantisMarkdown.php Diff File