How can I make a word in a code sample bold? I only see asterisks around the expected bold text.
sample **sample** sample
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.Sign up to join this community
<pre> formatting and HTML tags.
<pre> sample <b>sample</b> sample </pre>
sample sample sample
Since you can use other HTML tags as well, this is nice for including inline documentation for commands or classes, etc.:
<pre> <i><a href="http://manpages.ubuntu.com/manpages/dapper/man1/prename.1.html">rename</a></i> ’s/\.bak$//’ *.bak </pre>
rename 's/\.bak$//' *.bak
But, with any formatting tricks, please don't overdo it.
Disclaimer: I do not condone this, I'm just pointing out a possibility (for the sake of completion)
The basic idea is to apply bold/italic formatting to backtick-enclosed string (instead of applying within the backticks), then put the code spans side by side so that they render as a single code span.
Huge drawback: no syntax highlighting
> *`rename`*`'s/\.bak$//' *.bak`
Bold and italics side by side
You need a non-printing character or a zero-width character (e.g. zero width space
​) to separate the markdown for bold and markdown for italics.
When you line up two code spans (with different formatting) side by side, there is always a space in between.
So it's not possible to apply say bold formatting to a string within double quotes like
print "Hello world"; without a space between the string and quotes.
`print "`**`Hello world`**`";`
would render as
Others (left as exercise to the reader)