GitHub – How to Use Escape Characters for Special Characters in Markup

formattinggithubhtmlspecial characters

Background
I realize that markup is implementation without a specification but it basically is just a tiny little node stemming from SGML and the like. On GitHub I always use the ` symbol with a closed back tic to indicate code when it's inline with a sentence. This often happens with bash/shell scripting in this particular scenario.

Example #1 – Block Code
If you are looking for oracle's creg ini file you would know that on Oracle Cloud you can view it using view /var/opt/oracle/creg/ORCL.ini. However, this assumes you used the recommended settings for simple DBaaS provision. If you named your database MFG the command would be view /var/opt/oracle/creg/MFG.ini. Thankfully there is an environment variable that holds the database name. And if I were writing a simple bash script it would look like:

#!/bin/bash

cd /var/opt/oracle/creg/`printenv ORACLE_SID`.ini

So that prints fine in a block.

Exampe #2 – Inline
So if I simply want to tell a user to 'cd /var/opt/oracle/creg/printenv ORACLE_SID.ini' I shouldn't have to make a block.

Question
IS there an escape character in GitHub's markup implementation? I want the entire thing to show just like a normal line of code. It's better on StackOverflow on GitHub it basically breaks the page.

Best Answer

GitHub uses Markdown (specifically a custom 'flavour' thereof), and in Markdown you can escape backticks in code by using double backticks: https://github.com/mattcone/markdown-guide/blob/master/_basic-syntax/code.md#escaping-backticks

If the word or phrase you want to denote as code includes one or more backticks, you can escape it by enclosing the word or phrase in double backticks (``).