View Issue Details

IDProjectCategoryView StatusLast Update
0022333mantisbtmarkdownpublic2017-04-01 00:13
Reporterj_schultzAssigned 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

View 2 revisions

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

View 2 revisions

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

View 2 revisions

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

View 2 revisions

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

View 3 revisions

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.
mod - plugins/MantisCoreFormatting/core/MantisMarkdown.php Diff File

Issue History

Date Modified Username Field Change
2017-02-07 12:46 j_schultz New Issue
2017-02-14 09:50 j_schultz Note Added: 0055672
2017-02-14 09:58 atrol Relationship added child of 0022180
2017-02-27 09:58 joel Note Added: 0055795
2017-02-27 09:59 joel File Added: Screen Shot 2017-02-27 at 10.59.17 PM.png
2017-02-27 10:02 j_schultz Note Added: 0055796
2017-02-27 10:05 joel Assigned To => joel
2017-02-27 10:05 joel Status new => resolved
2017-02-27 10:05 joel Resolution open => fixed
2017-02-27 10:05 joel Status resolved => closed
2017-02-27 10:10 j_schultz Status closed => feedback
2017-02-27 10:10 j_schultz Resolution fixed => reopened
2017-02-27 10:10 j_schultz Note Added: 0055797
2017-02-27 10:10 j_schultz File Added: github-headline.png
2017-02-27 10:33 joel Note Added: 0055798
2017-02-27 10:37 joel Note Edited: 0055798 View Revisions
2017-02-27 10:50 j_schultz Note Added: 0055800
2017-02-27 10:50 j_schultz Status feedback => assigned
2017-02-27 11:29 joel Note Added: 0055801
2017-02-27 11:47 joel Note Edited: 0055801 View Revisions
2017-02-27 17:46 joel Note Added: 0055810
2017-02-27 17:47 joel Status assigned => confirmed
2017-02-27 19:26 joel Note Edited: 0055810 View Revisions
2017-02-28 04:19 dregad Note Added: 0055816
2017-02-28 04:21 dregad Note Edited: 0055816 View Revisions
2017-03-01 09:12 joel Note Added: 0055839
2017-03-01 09:13 joel Note Edited: 0055839 View Revisions
2017-03-12 18:47 joel Note Edited: 0055839 View Revisions
2017-03-31 17:35 dregad Changeset attached => MantisBT master-2.2 e4c0cceb
2017-03-31 17:35 dregad Assigned To joel => dregad
2017-03-31 17:35 dregad Status confirmed => resolved
2017-03-31 17:35 dregad Resolution reopened => fixed
2017-03-31 17:35 dregad Fixed in Version => 2.2.3
2017-03-31 17:36 dregad Target Version => 2.2.3
2017-03-31 17:36 dregad Assigned To dregad => joel
2017-04-01 00:13 vboctoradmin Status resolved => closed