Markdown interpreted within title attributes


(PJH) #1

Since title attributes can’t actually render HTML, interpreting stuff that looks like Markdown and replacing it with HTML in such situations doesn’t really work…

2 examples, there are probably others (img e.g.)


##<abbr>:
Raw:

<abbr title="just to add some *emphasis* in the title">abbr</abbr>
                              ^        ^

Cooked:
abbr

Result:

 


##<a>:
Raw:

<a href="www.example.com" title="and some  more *emphasis* in this one">a</a>
                                                ^        ^

Cooked:
a


(Jeff Atwood) #2

Probably more relevant to the CommonMark spec than here.


(PJH) #3

Why? :confused:

No spec should be being applied to that part of raw, since any application of it does not result in what was intended - it should be left untouched.


(Sam Saffron) #4

Sure, but we should ensure the CM mark spec covers this, does it break on markdown it ?


(Yamikuronue) #5

The markdown spec covers what happens when you mix html with markdown? I thought it only covered markdown-exclusive situations. How do you form an abbr tag in pure markdown?


(PJH) #6

http://spec.commonmark.org/0.21/#raw-html

##6.8 Raw HTML
Text between < and > that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used.

Seems to cover it for me. Not sure what needs to be changed/addressed in the spec’, since it already seems to say:

unless I missed some context in my skimming of the spec’.


(Yamikuronue) #7

Huh, learn something new every day :slight_smile:


(Sam Saffron) #8

Im pretty afraid of fixing this, would much prefer to wait for the new markdown engine which does not have this issue.

https://markdown-it.github.io/


#9

I don’t think it’s just the markdown engine, It appears to affect the post-parsing engine as a whole. This isn’t the only time that data is incorrectly processed inside HTML tags. See Mentions break abbreviation tags, which I posted 2 months ago, for another example.

In fact, this markdown issue was pointed out in the third post of that bug topic.


(Mittineague) #10

I’m thinking this likely has something to do with “allow smilies in titles”


#11

Unlikely, considering we are talking about HTML title attributes, not topic titles.


(Sam Saffron) #12

abbr

Fixed… so closing


(Sam Saffron) #13