I have single quote inside my inline codes. Something like, "echo [single back quote] cat file.txt[single back quote]", where the whole thing within double quotes need to be shown as code. How do I display the single quotes? Which escape character need to be used? I tried \ without any avail.
3 Answers
You can write any character using the HTML character entity, in this case `
becomes
`
I'm using first the written symbol ` Now I'm using the character entity ` All of this was writen using <pre> tags
You can say echo `cat file.txt`
by typing
``echo `cat file.txt` ``
or
<code>echo \`cat file.txt`</code>
The first example requires a space after the file.txt`
to disambiguate the triple backquote that would otherwise occur.
I don't fully understand why the second example requires a backslash before the first backtick
but not the second one.
-
If you have two unescaped backticks, they get converted into a
<code>
block. If you escape the first one, the second one doesn't get converted because there's only one left—as long as you don't add more text that also happens to contain a backtick to the same paragraph. Same with e.g.*
– a single occurrence doesn't italicize anything.– Daniel Beck ModCommented Dec 23, 2013 at 8:41
(Admission, just wanted an excuse to do unspeakable things to markdown)
' OH HARK, A SINGLE QUOTE?
Like that
" DOUBLE QUOTES TOO!
` OR EVEN A BACKTICK!
You cannot however...
wrap pre tags in pre tags
But everything else is fair game.
Just to make sure This works With multiple lines `````````
pre tags seem un-wrappable, alas, so you will have to check the edit history, or pretend to edit this to see my markdown.
-
Please show you source to let us know how you have done it. How can I put, "echo [single back quote] cat file.txt[single back quote]", where the whole thing within double quotes need to be shown as code inline? Please see my original question. Also, please see the link on comment which provided one answer. Is there any other way? No escape character?– MasroorCommented Oct 27, 2013 at 12:16
-
try <pre>echo ` cat file.txt </pre> . There's no way to escape the pre tags. Alternately, I'll do a trivial edit, and you can diff the markdown in the edit history.– Journeyman Geek ModCommented Oct 27, 2013 at 13:54
-
-
I tried pretending to edit your post, but that edit link is dimmed. Anyway, asking that question again, can not I have two back quotes in the same inline code?– MasroorCommented Oct 27, 2013 at 14:32
-
-
@Braiam Yes, those `, two at different places in the same inline code.– MasroorCommented Oct 27, 2013 at 15:32