Skip to content

Latest commit

 

History

History
448 lines (340 loc) · 10.4 KB

File metadata and controls

448 lines (340 loc) · 10.4 KB

GitHub Markdown

Escape backticks

Click to see more ...

See Markdown: Syntax.

Excape backticks in plain text

Backticks in plain text can be backslash-excaped:

The symbol "\`" is called a backtick.

The symbol "`" is called a backtick.

Excape backticks in inline code blocks

Backticks in inline code blocks can be excaped by multiple backticks with spaces in between:

The keyboard shortcut (``` ^` ```) can be used to open a terminal window in VS Code.

The keyboard shortcut (^`) can be used to open a terminal window in VS Code.

Escape backticks

Use more backticks instead of only 3 backticks to escape backticks inside code block:

````
Some code

```
Some code inside another code
```
````
Some code

```
Some code inside another code
```

Souce code color highlighting

Click to see more ...

See:

Console code


```console
$ pip3 install mlhub
Collecting mlhub
  Downloading https://files.pythonhosted.org/packages/61/4c/0fe1b263358bad88525594a8dd319c40934c16e6c3cc01f32b0b8edb5537/mlhub-2.0.1.tar.gz
Collecting pyyaml (from mlhub)
...
$ ml --version
mlhub version 2.0.1
```
$ pip3 install mlhub
Collecting mlhub
  Downloading https://files.pythonhosted.org/packages/61/4c/0fe1b263358bad88525594a8dd319c40934c16e6c3cc01f32b0b8edb5537/mlhub-2.0.1.tar.gz
Collecting pyyaml (from mlhub)
...
$ ml --version
mlhub version 2.0.1

C++


```c++
#include

int main() {
  std::cout << "Hello World!\n";
  return 0;
}
```
#include<iostream>

int main() {
  std::cout << "Hello World!\n";
  return 0;
}

No highlight


```no-highlight
# Header 1
## Header 2
### Header 3
```
# Header 1
## Header 2
### Header 3

Table

Click to see more ...

See:

What GitHub Markdown can do

NOTE: Blank/empty cells should use &nbsp;, otherwise they will not be rendered correctly.

|header 1|header 2|center|left aligned|right aligned|
|--------|--------|:----:|:-----------|------------:|
| r 1 c 1 | r 1 c 2 | r 1 c 3 blablabla | r 1 c 4 blablabla | r 1 c 5 blablabla |
| &nbsp;  | r 2 c 2 | r 2 c 3 | r 2 c 4 | r 2 c 5 |
| r 3 c 1 | r 3 c 2 | r 3 c 3 | r 3 c 4 | r 3 c 5 |
header 1 header 2 center left aligned right aligned
r 1 c 1 r 1 c 2 r 1 c 3 blablabla r 1 c 4 blablabla r 1 c 5 blablabla
  r 2 c 2 r 2 c 3 r 2 c 4 r 2 c 5
r 3 c 1 r 3 c 2 r 3 c 3 r 3 c 4 r 3 c 5

What can only be done by HTML

<table>
<thead><tr><th>header 1</th><th>header 2</th><th>header 3</th></tr></thead>
<tbody>
<tr><td>row 1 column 1</td><td align="right">row 1 column 2 blablabla</td><td rowspan="2">row 1-2 column 3</td></tr>
<tr><td>row 2 column 1</td><td align="right">row 2 column 2</td></tr>
<tr><td colspan="3">row 3 column 1-3</td></tr>
</tbody>
</table>
header 1header 2header 3
row 1 column 1row 1 column 2 blablablarow 1-2 column 3
row 2 column 1row 2 column 2
row 3 column 1-3

To put code blocks inside a table cell, add a blank line before the markdown code block:

<table>
<tr><th>YAML</th><th>JSON</th></tr>
<tr>
  <td>
  
```yaml
number: 3.14159
bool: true
string: 'hello'
another-string: bye bye
dict:
  name: Simon
  weight: 66
another-dict: {name: Simon, weight: 66}
```
  </td>
  <td>

```json
{
  "number": 3.14159,
  "bool": true,
  "string": "hello",
  "another-string": "bye bye",
  "dict": {
    "name": "Simon",
    "weight": 66
  },
  "another-dict": {
    "name": "Simon",
    "weight": 66
  }
}
```
  </td>
</tr>
</table>
YAMLJSON
number: 3.14159
bool: true
string: 'hello'
another-string: bye bye
dict:
  name: Simon
  weight: 66
another-dict: {name: Simon, weight: 66}
{
  "number": 3.14159,
  "bool": true,
  "string": "hello",
  "another-string": "bye bye",
  "dict": {
    "name": "Simon",
    "weight": 66
  },
  "another-dict": {
    "name": "Simon",
    "weight": 66
  }
}

How to fold/collapse a setion

Click to see more ...

This can be done by using HTML since it is not directly supported by GitHub Markdown.

See:

<details>
<summary>Click here ...</summary>

This sentence will be collapsed/expanded by clicking the line above.

</details>
Click here ...

This sentence will be collapsed/expanded by clicking the line above.

Align images/pictures

Click to see more ...

To show a single picture in a GitHub markdown file, one can use ![alternative text](URL). But aligning pictures can be done by using HTML since it is not directly supported by GitHub Markdown.

See:

Center alignment

<p align="center"> 
  <img src="put image url here" alt="alternate text">
</p>

Left Alignment

<img align="left" src="put image url here">

Right Alignment

<img align="right" src="put image url here">

Side by Side

The most important is to adjust the height or width of the pictures to let them fit into a row.

<img align="center" src="url 1" height="250"/>
<img align="center" src="url 2" height="250"/>

LaTeX math equation

Click to see more ...

This can be done by using the service from CodeCogs Equation. You can put the LaTeX math equation as parameter to the end of http://latex.codecogs.com/svg.latex?, then a svg image of the equation will be generated so that you can put the composed link as embedded image in Markdown doc. For example, to display LeTaX equation \frac{1}{1+sin(x)}, you can use

![my equation](http://latex.codecogs.com/svg.latex?\frac{1}{1+sin(x)})

Then it will be shown as a image looks like my equation.

Update on 21/11/2022

As announced in 19/05/2022 at Math support in Markdown, GitHub now supports math expressions natively in Markdown by using the JavaScript library MathJax. Available TeX/LaTeX commands are listed in Supported TeX/LaTeX commands. See Writing mathematical expressions: Use Markdown to display mathematical expressions on GitHub.

  • For inline math expressions, GitHub provides two ways:
    • We can surround the expression with $.
    • Or we start the expression with $` and end it with `$ which is recommended because it is always valid when the expression contains characters overlapping with markdown syntax.
  • For display style math expressions, we can use start a new line and delimit the expression with two dollar symbols $$ or the ```math code block syntax.
    • However, the ```math code block syntax will not be rendered, when
      • being inside the <details></details> folded section mentioned above, or
      • being in a list. In other words, no indentation is allowed before ```math.

For example, the following block

```math
\mathbf{J} = [
  \frac{\partial\mathbf{Y}}{\partial x_1},
  \frac{\partial\mathbf{Y}}{\partial x_2},
  \ldots,
  \frac{\partial\mathbf{Y}}{\partial x_n}
  ] =
  \begin{bmatrix}
    \frac{\partial f_1}{\partial x_1} & \cdots &\frac{\partial f_1}{\partial x_n} \\
    \vdots                            & \ddots & \vdots  \\
    \frac{\partial f_m}{\partial x_1} & \cdots & \frac{\partial f_m}{\partial x_n}
  \end{bmatrix}
```

will be rendered by GitHub as:

$$\mathbf{J} = [ \frac{\partial\mathbf{Y}}{\partial x_1}, \frac{\partial\mathbf{Y}}{\partial x_2}, \ldots, \frac{\partial\mathbf{Y}}{\partial x_n} ] = \begin{bmatrix} \frac{\partial f_1}{\partial x_1} & \cdots &\frac{\partial f_1}{\partial x_n} \\\ \vdots & \ddots & \vdots \\\ \frac{\partial f_m}{\partial x_1} & \cdots & \frac{\partial f_m}{\partial x_n} \end{bmatrix}$$

Reference

GitHub official reference

Other reference