Open edent opened 2 weeks ago
Note that you can add no-break spaces on those empty lines if you want to fix things without fussing with the code.
Also, we have the same problem with other tags too:
<span title="A
multiline
title">text with title</span>
I think the basic issue is that the HTML block parser ignores span-level tags. Those are parsed at a later stage in parseSpan
, but that stage is after splitting in paragraphs.
I suppose changing the regex here to accept all tag names would work. https://github.com/michelf/php-markdown/blob/51613168d71787b0fe8472166ccbfa8d285c02cd/Michelf/MarkdownExtra.php#L428-L433 Things to watch for:
parseSpan
will need adjustments for dealing with those hashed tags. parseSpan
. Disagreements between the two algorithms could cause some behaviors to change when it comes to tags in code spans.Honestly, I'm not sure it's worth solving.
If I have this HTML:
It is transformed into:
Changing this line:
https://github.com/michelf/php-markdown/blob/51613168d71787b0fe8472166ccbfa8d285c02cd/Michelf/MarkdownExtra.php#L342
to
Fixes the issue.
I can't think of anything within an
<img>
element which should be altered by Markdown. Alt text can't contain HTML elements, src shouldn't be altered, it's a self-closing element so won't have any contents.Are there any downsides to adding img to this regex?