question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

escaping asterisks inside italic block

See original GitHub issue

Reported in a Google Groups post.


Is it possible to escape asterisks within an italic (or bold) block?

What I type in:

*hello* 

\*hello\* 

*\*hello\** 

\**hello*\* 

*hello \* world* 

I expect something like:

<p><em>hello</em></p> 
<p>*hello*</p> 
<p><em>*hello*</em></p> 
<p>*<em>hello</em>*</p> 
<p><em>hello * world</em></p> 

What I get in from markdown-here:

<p><em>hello</em></p> 
<p>*hello*</p> 
<p><em>\</em>hello**</p> 
<p>*<em>hello</em>*</p> 
<p><em>hello \</em> world*</p> 

(style properties removed for readability.) The first two are (as expected) fine. The third thinks I want to italize the backslash. The fourth is the closest, but perhaps I want the asterisks italicized (it sounded fine before I actually read what I am saying …). From the last it appears that the escaped-asterisk is not considered inside a bold/italic block.


Workaround: Instead of trying to escape the asterisks, use one of the HTML entities for asterisk, like: &ast;

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:51
  • Comments:8

github_iconTop GitHub Comments

15reactions
open-sourceresscommented, Feb 25, 2017

I did use &ast; and it does work, but I agree it’s less obvious. I will fix the >, thank you for that.

5reactions
r2evanscommented, Feb 24, 2017

Having a bare > in HTML can be problematic, so converting it to &gt; is the safer thing to do. However, the \<\em> is an issue (as is the unconverted trailing asterisk), apparently MDH is missing the preceding backslash. You can force the literal asterisk with &ast;, I think, though that’s less convenient and obvious.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Still can't figure out how to post asterisks without italics or bold ...
I tried the backslash before the asterisks trick to escape formatting and it posted the comment as backslashes around italic font.
Read more >
4.16 Escape special characters | R Markdown Cookbook
You need to escape the underscores if you want verbatim underscores instead of italic text. The way to escape a special character is...
Read more >
Display * (asterisk) in textfield and disable italic function
As this field ist WYSIWYG and the text is generated and saved as HTML code as I write, the workarounds with kirbytext hooks...
Read more >
How to italicize reStructuredText when something other than a ...
I've figured it out, I need to use an escaped space, which will behave like space but will not show up. See here....
Read more >
Escape and Prevent Substitutions | Asciidoctor Docs
The asterisks around it are preserved. \§ appears as an entity reference. It's not converted into the section symbol (§). \=> The backslash...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found