You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for reporting this, it looks like it is really broken. I'm not keen on changing the em regex since it changed quite a lot of times in the past and it looks really awful now.
Moreover, that commonmark spec for emphasis really is hell!
I think the usual approach to make emphasis work with underscores in it is to use stars as delimiters, instead:
$ bin/marked
# Hello!
Here is some emphasis: *Hello_World*!
Done.
<h1id="hello-">Hello!</h1><p>Here is some emphasis: <em>Hello_World</em>!</p><p>Done.</p>
Thank you for your help. I am aware of this workaround, but my team uses Prettier formatter for our documents. It is a great tool to have an unified syntax, unfortunately it is a pain in the neck for this particular issue, because it automatically replaces the star delimiters with underscores.
Interesting. Just to make sure I'm understanding, without getting too into the weeds: Prettier essentially "transpiles," for lack of a better term, asterisks into underscores. Then that's the result you are displaying?
I guess I'm trying to see the flow of data, from a user perspectvie, at a high-level:
Yes, pretty much, you can observe it on their playground. Every time we save a file on our editor, Prettier "transpiles" the file (adding spaces into tables to make them look like actual tables, replacing asterisks into underscores for emphasis, etc.) which then is used by Marked for displaying.
@aduh95: Gotcha, I'm going to convert this to annoying for now because it's more of an integration issue (for this specific case), and trust @Feder1co5oave when he says it's still broken. Thanks.
(As you can tell by the changes in the ticket types, I had an internal battle on where exactly to put it.) :)
Activity
Feder1co5oave commentedon Jan 12, 2018
Thanks for reporting this, it looks like it is really broken. I'm not keen on changing the
emregex since it changed quite a lot of times in the past and it looks really awful now.Moreover, that commonmark spec for emphasis really is hell!
I think the usual approach to make emphasis work with underscores in it is to use stars as delimiters, instead:
Hope this helps.
Still, this is broken.
aduh95 commentedon Jan 12, 2018
Thank you for your help. I am aware of this workaround, but my team uses Prettier formatter for our documents. It is a great tool to have an unified syntax, unfortunately it is a pain in the neck for this particular issue, because it automatically replaces the star delimiters with underscores.
joshbruce commentedon Jan 12, 2018
Interesting. Just to make sure I'm understanding, without getting too into the weeds: Prettier essentially "transpiles," for lack of a better term, asterisks into underscores. Then that's the result you are displaying?
I guess I'm trying to see the flow of data, from a user perspectvie, at a high-level:
User -> Markdown -> Marked -> Prettier -> display
??
aduh95 commentedon Jan 13, 2018
Yes, pretty much, you can observe it on their playground. Every time we save a file on our editor, Prettier "transpiles" the file (adding spaces into tables to make them look like actual tables, replacing asterisks into underscores for emphasis, etc.) which then is used by Marked for displaying.
The flow of data is more like that:
User -> Markdown -> Prettier -> Marked -> display
joshbruce commentedon Jan 13, 2018
@aduh95: Gotcha, I'm going to convert this to annoying for now because it's more of an integration issue (for this specific case), and trust @Feder1co5oave when he says it's still broken. Thanks.
(As you can tell by the changes in the ticket types, I had an internal battle on where exactly to put it.) :)
UziTech commentedon Dec 5, 2018
looks like this is fixed in the latest version. demo