in markdown, my_stock_index
is mystockindex. But I want it to show my_stock_index
. How can do that?
-
1Which implementation of Markdown are you using?– ChrisMar 6, 2016 at 14:20
-
@Chris, Markdown Pad– GoingMyWayMar 7, 2016 at 5:00
-
@Chris do you mean that this isn't standard behavior?– lulalalaApr 12, 2018 at 1:36
-
@lulalala, many Markdown questions on SO target some implementation other than the original and some common implementations handle this differently, e.g. GitHub Flavored Markdown and GitLab Flavored Markdown.– ChrisApr 12, 2018 at 2:25
3 Answers
You just escape it with a backslash:
my\_stock\_ticker
is what you type to get my_stock_ticker
The syntax seems to work for all markdown parsers. However, php markdown parsers use the numeric character reference _
instead of the actual character in it's output.
The single backslash escape works fine in Jupyter unless you are in an italicized block, in which case, you want to close the italicized block, write the escaped underscore, then start the italicized block again.
_the cookie_\__cutter in italics_
-
15Or you can use
*the cookie\_cutter in italics*
and avoid the extra closing.– CarlosSep 12, 2018 at 15:34 -
There is also the option to use backticks. This is actually used to refer to mark the text as inline code, but where else would you use underscores right? Besides it is much easier than managing the backslash stuff :)
`my_stock_index`
-
Thanks! This is a good solution when you don't have control over the individual characters and can't necessarily escape them– TheHannaApr 9, 2020 at 17:01
-
You are right, "where else would I use underscores"? :) Sep 4, 2020 at 10:08
-