2

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.

1
  • Found the answer here
    – Masroor
    Commented Oct 27, 2013 at 1:56

3 Answers 3

3

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
1
  • Excellent, this is what I was looking for.
    – Masroor
    Commented Oct 27, 2013 at 16:04
2

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.

1
  • 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 Mod
    Commented Dec 23, 2013 at 8:41
0

(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.

6
  • 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?
    – Masroor
    Commented 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 Mod
    Commented Oct 27, 2013 at 13:54
  • meta.superuser.com/revisions/… there we are!
    – Journeyman Geek Mod
    Commented Oct 27, 2013 at 13:58
  • 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?
    – Masroor
    Commented Oct 27, 2013 at 14:32
  • you mean these `?
    – Braiam
    Commented Oct 27, 2013 at 14:36
  • @Braiam Yes, those `, two at different places in the same inline code.
    – Masroor
    Commented Oct 27, 2013 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .