parsedown
parsedown copied to clipboard
Emphasis management error
In a document, I have this markdown :
this_text_is_normal
_this text_is italic_
I expect something like :
<p>this_text_is_normal
<em>this text_is italic</em></p>
But parsedown generate :
<p>this_text_is_normal
_this text<em>is italic</em></p>
And what is the logic behind your expectations?
text_is
is a word, there's no separator. It's the same logic as this_text_is_normal
.
Try to enter the example in Github and look the result.
this_text_is_normal
*this text_is italic*
@kminchev Your solution works, I'm going to work with at the moment.
But there is still a bug with this input :
this_text_is_normal
_this text_is italic_
Same issue with __foo_bar__
:
- expected:
<strong>foo_bar</strong>
- actual:
__foo_bar__
Note that all markdown parsers supports this syntax (proof here: foo_bar).
I just ran into a similar issue to this where words have control characters in them. For example, the decentralized social network Diaspora* is formally written with an asterisk in the name (i.e., the correct typographical representation of the project is Diaspora*
with an asterisk, not Diaspora
with no asterisk). The same is true for some renderings of words in sociology (like trans*
) and, of course, other areas of more technical specializations, such as those discussed above.
If I have two paragraphs of text that includes such a phrase, like this:
Let's query the Diaspora* pod to see what happens. Note that Diaspora* has no formal API to speak of, but this query does work, so *shrug*.
My expectation is that only the final word in the second paragraph (*shrug*
) will be italicized. However, using Parsedown, what actually gets italicized is the text * has no formal API to speak of, but this query does work, so *
.
Basically this is just…well, incorrect, it seems to me.
This seems to be related to #703 and #364