Markdown Cheatsheet ===== # TOC - [Headings](#Headings) - [Emphasis](#2nd) - [Monospace font](#Monospace-font) - [Line breaks](#Line-breaks) - [Indenting](#Indenting) - [Lists](#Lists) - [Numbered lists](#Numbered-lists) - [Mathematical Equations](#Mathematical-Equations) - [Colored text](#Colored-text) - [Colored note boxes](#Colored-note-boxes) - [Images](#Images) - [Geometric shapes](#Geometric-shapes) - [Horizontal lines](#Horizontal-lines) - [Internal links](#Internal-links) - [External links](#External-links) # Headings Use the number sign (#) followed by a blank space for notebook titles and section headings: `# for titles` `## for major headings` `### for subheadings` `#### for 4th level subheadings` <a id="2nd"></a> # Text styling Bold text: `__string__` or `**string**` Italic text: `_string_` or `*string*` Underline: `++inserted text++` -> ++inserted text++ Mark with yellow: `==this is rendered as marked text==` -> ==this is rendered as marked text== Subscript: `H~2~O` -> H~2~O `X~i~` -> X~i~ `X~ij~` -> X~ij~ Superscript: `X^2^` -> X^2^ `e^(-1/X)^` -> e^(-1/X)^ # Monospace font Surround text with a grave accent (`) also called a back single quotation mark, for example: $`string`$ # Line breaks Add line breaks by entering line space. Sometimes markdown doesn’t make line breaks when you want them. To force a linebreak, use the following code: `<br>` # Indenting/quoting Use the greater than sign (>) followed by a space, for example: > Text that will be indented when the Markdown is rendered. Any subsequent text is indented until the next carriage return. # Lists ## Unorderd lists To create a circular bullet point, use one of the following methods. Each bullet point must be on its own line. A hyphen (-) followed by one or two spaces, for example: - Bulleted item A space, a hyphen (-) and a space, for example: - Bulleted item An asterisk (*) followed by one or two spaces, for example: * Bulleted item To create a sub bullet, press Tab before entering the bullet point using one of the methods described above. For example: - Main bullet point - Sub bullet point ## Numbered/ordered lists To create a numbered list, enter 1. followed by a space, for example: 1. Numbered item 1. Numbered item For simplicity, you use 1. before each entry. The list will be numbered correctly when you run the cell. To create a substep, press Tab before entering the numbered item, for example: 1. Numbered item 1. Substep ## Checklist/ todo list - [ ] Incomplete item - [x] Completed item # Collapsed text Add collapsed text if user wants to see more details. `<details> collapsed text here </details`> <details> collapsed text </details> --- Or use the following: ``` :::spoiler This is a collapsed text. ::: ``` :::spoiler This is a collapsed text. ::: # Mathematical Equations Surround mathematical symbols with a dollar sign (`$`), for example: `$ mathematical symbols $` To include a math expression inline with your text, delimit the expression with a dollar symbol `$`. This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$ To add a math expression as a block, start a new line and delimit the expression with two dollar symbols `$$`. `$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$` $$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$ Example2: `When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$` When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ __[Github on math equations](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions)__ __[Latex math notation](https://rpruim.github.io/s341/S19/from-class/MathinRmd.html#:~:text=Math%20inside%20RMarkdown,10n%3D1n2.)__ [Latex math symbols](https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols) We can create subscript and super script easily using math $A^b$ $A_b$ # Colored text/ Alert area Use this code for coloring the text: `<font color=blue|red|green|pink|yellow>start your text here</font>` <font color=red>start your text here</font> or, `<p style="color:green">your text here.</p>` > Example: <font color=red>write your text here </font> > <p style="color:green">Make this text green.</p> Not all markdown code works within a font tag, so review your colored text carefully! ## Colored note boxes Use one of the following `<div>` tags to display text in a colored box. The color of the box is determined by the alert type that you specify: **Blue boxes (alert-info)** ``` :::info This is a alert area. ::: ``` :::info This is a alert area. ::: HTML syntax ``` <div class="alert alert-block alert-info"> <b>Tip:</b> Use blue boxes (alert-info) for tips and notes. If it’s a note, you don’t have to include the word “Note”. </div> ``` <div class="alert alert-block alert-info"> <b>Tip:</b> Use blue boxes (alert-info) for tips and notes. If it’s a note, you don’t have to include the word “Note”. </div> **Yellow boxes (alert-warning)** ``` :::warning This is a alert area. ::: ``` :::warning This is a alert area. ::: ``` <div class="alert alert-block alert-warning"> <b>Example:</b> Use yellow boxes for examples that are not inside code cells, or use for mathematical formulas if needed. </div> ``` <div class="alert alert-block alert-warning"> <b>Example:</b> Use yellow boxes for examples that are not inside code cells, or use for mathematical formulas if needed. </div> **Green boxes (alert-success)** ``` :::success This is a alert area. ::: ``` :::success This is a alert area. ::: ``` <div class="alert alert-block alert-success"> <b>Up to you:</b> Use green boxes sparingly, and only for some specific purpose that the other boxes can't cover. For example, if you have a lot of related content to link to, maybe you decide to use green boxes for related links from each section of a notebook. </div> ``` <div class="alert alert-block alert-success"> <b>Up to you:</b> Use green boxes sparingly, and only for some specific purpose that the other boxes can't cover. For example, if you have a lot of related content to link to, maybe you decide to use green boxes for related links from each section of a notebook. </div> **Red boxes (alert-danger)** ``` :::danger This is a alert area. ::: ``` :::danger This is a alert area. ::: ``` <div class="alert alert-block alert-danger"> <b>Just don't:</b> In general, avoid the red boxes. These should only be used for actions that might cause data loss or another major issue. </div> ``` <div class="alert alert-block alert-danger"> <b>Just don't:</b> In general, avoid the red boxes. These should only be used for actions that might cause data loss or another major issue. </div> # Images - You can attach image files directly to a notebook in Markdown cells by dragging and dropping it into the cell. - You can copy image and paste it in markdown cell using 'ctrl+V' ![image.png](attachment:554f7dcf-b728-4373-a5fe-b653326daed3.png) - You can copy image address and mention it below code: `![](http://image_address)` ![](https://cdn.wallstreetmojo.com/wp-content/uploads/2020/08/Basel-III-1.jpg.webp) # Geometric shapes Use &# followed by the decimal or hex reference number for the shape. Example: &#9658; For a list of reference numbers, see https://www.w3schools.com/charsets/ref_utf_geometric.asp # Horizontal lines use `***` or `---` *** --- # Internal links To link to a section within your notebook, use the following code: `[Section title](#section-title)` For the text inside the parentheses, replace any spaces and special characters with a hyphen. For example, if your section is called 'Colored note boxes', you'd enter: [Colored note boxes](#Colored-note-boxes) Alternatively, you can add an ID above the section: `<a id="section_ID"></a>` Important: Each ID in the notebook must be unique. To link to a section that has an ID, use the following code: `[Section title](#section_ID)` Important: Test all internal links to ensure that they work. ## External links To link to an external site, use the following code: __[Markdown for Jupyter notebooks cheatsheet](https://www.ibm.com/docs/en/watson-studio-local/1.2.3?topic=notebooks-markdown-jupyter-cheatsheet)__ __[Markdown guide](https://www.markdownguide.org/)__