\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{bladabuska} \pdfinfo{ /Title (markdown-syntax-cheat-sheet.pdf) /Creator (Cheatography) /Author (bladabuska) /Subject (Markdown Syntax Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{008000} \definecolor{LightBackground}{HTML}{F7FBF7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Markdown Syntax Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{bladabuska} via \textcolor{DarkBackground}{\uline{cheatography.com/173176/cs/44600/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}bladabuska \\ \uline{cheatography.com/bladabuska} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 10th October, 2024.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Headings}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create a heading, add number signs (`\#`) in front of a word or phrase. The number of number signs you use should correspond to the heading level. For example, to create a heading level three (`\textless{}h3\textgreater{}`), use three number signs (e.g., `\#\#\# My Header`). \newline % Row Count 6 (+ 6) `\# Heading level 1` \newline % Row Count 7 (+ 1) `\#\# Heading level 2` \newline % Row Count 8 (+ 1) `\#\#\# Heading level 3` \newline % Row Count 9 (+ 1) `\#\#\#\# Heading level 4` \newline % Row Count 10 (+ 1) `\#\#\#\#\# Heading level 5` \newline % Row Count 11 (+ 1) `\#\#\#\#\#\# Heading level 6` \newline % Row Count 12 (+ 1) Alternatively, on the line below the text, add any number of `==` characters for heading level 1 or `-{}-` characters for heading level 2. \newline % Row Count 15 (+ 3) `Heading level 1` \newline % Row Count 16 (+ 1) `===============` \newline % Row Count 17 (+ 1) `Heading level 2` \newline % Row Count 18 (+ 1) `-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-{}-`% Row Count 19 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Markdown applications don't agree on how to handle a missing space between the number signs (`\#`) and the heading name. For compatibility, always put a space between the number signs and the heading name. \newline \newline You should also put blank lines before and after a heading for compatibility} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Paragraphs}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create paragraphs, use a blank line to separate one or more lines of text.% Row Count 2 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Unless the paragraph is in a list, don't indent paragraphs with spaces or tabs.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Line Breaks}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create a line break or new line (`\textless{}br\textgreater{}`), end a line with two or more spaces, and then type return. \newline % Row Count 3 (+ 3) You can use two or more spaces (commonly referred to as "trailing white space") for line breaks in nearly every Markdown application, but it's controversial. It's hard to see trailing white space in an editor, and many people accidentally or intentionally put two spaces after every sentence. For this reason, you may want to use something other than trailing white space for line breaks. If your Markdown application supports HTML, you can use the `\textless{}br\textgreater{}` HTML tag.% Row Count 13 (+ 10) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{For compatibility, use trailing white space or the `\textless{}br\textgreater{}` HTML tag at the end of the line. \newline \newline CommonMark and a few other lightweight markup languages let you type a backslash (`\textbackslash{}\textbackslash{}`) at the end of the line, but not all Markdown applications support this, so it isn't a great option from a compatibility perspective. \newline \newline And at least a couple lightweight markup languages don't require anything at the end of the line - just type return and they'll create a line break.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Ordered Lists}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create an ordered list, add line items with numbers followed by periods. The numbers don't have to be in numerical order, but the list should start with the number one. \newline % Row Count 4 (+ 4) `1. First item` \newline % Row Count 5 (+ 1) `2. Second item` \newline % Row Count 6 (+ 1) `3. Third item` \newline % Row Count 7 (+ 1) ` 1. Indented item` \newline % Row Count 8 (+ 1) ` 2. Indented item` \newline % Row Count 9 (+ 1) `4. Fourth item`% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{CommonMark and a few other lightweight markup languages let you use a parenthesis (`)`) as a delimiter (e.g., `1) First item`), but not all Markdown applications support this, so it isn't a great option from a compatibility perspective. For compatibility, use periods only.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Unordered Lists}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create an unordered list, add dashes (`-`), asterisks (`*`), or plus signs (`+`) in front of line items. Indent one or more items to create a nested list. \newline % Row Count 4 (+ 4) `- First item` \newline % Row Count 5 (+ 1) `- Second item` \newline % Row Count 6 (+ 1) `- Third item` \newline % Row Count 7 (+ 1) ` - Indented item` \newline % Row Count 8 (+ 1) ` - Indented item` \newline % Row Count 9 (+ 1) `- Fourth item` \newline % Row Count 10 (+ 1) `+ First item` \newline % Row Count 11 (+ 1) `+ Second item` \newline % Row Count 12 (+ 1) `+ Third item` \newline % Row Count 13 (+ 1) ` + Indented item` \newline % Row Count 14 (+ 1) ` + Indented item` \newline % Row Count 15 (+ 1) `+ Fourth item` \newline % Row Count 16 (+ 1) `* First item` \newline % Row Count 17 (+ 1) `* Second item` \newline % Row Count 18 (+ 1) `* Third item` \newline % Row Count 19 (+ 1) ` * Indented item` \newline % Row Count 20 (+ 1) ` * Indented item` \newline % Row Count 21 (+ 1) `* Fourth item` \newline % Row Count 22 (+ 1) Starting Unordered List Items With Numbers \newline % Row Count 23 (+ 1) If you need to start an unordered list item with a number followed by a period, you can use a backslash (`\textbackslash{}\textbackslash{}`) to escape the period. \newline % Row Count 26 (+ 3) `- 1968\textbackslash{}. A great year!` \newline % Row Count 27 (+ 1) `- I think 1969 was second best.`% Row Count 28 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Markdown applications don't agree on how to handle different delimiters in the same list. For compatibility, don't mix and match delimiters in the same list — pick one and stick with it.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Adding Elements in Lists}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To add another element in a list while preserving the continuity of the list, indent the element four spaces or one tab, as shown in the following examples. \newline % Row Count 4 (+ 4) {\bf{Paragraphs}} \newline % Row Count 5 (+ 1) `* This is the first list item.` \newline % Row Count 6 (+ 1) `* Here's the second list item.` \newline % Row Count 7 (+ 1) ` \newline % Row Count 8 (+ 1) ` I need to add another paragraph below the second list item.` \newline % Row Count 10 (+ 2) `* And here's the third list item.` \newline % Row Count 11 (+ 1) {\bf{Blockquotes}} \newline % Row Count 12 (+ 1) `* This is the first list item.` \newline % Row Count 13 (+ 1) `* Here's the second list item.` \newline % Row Count 14 (+ 1) ` \textgreater{} A blockquote would look great below the second list item.` \newline % Row Count 16 (+ 2) `* And here's the third list item.` \newline % Row Count 17 (+ 1) {\bf{Code blocks}} \newline % Row Count 18 (+ 1) Code blocks are normally indented four spaces or one tab. When they're in a list, indent them eight spaces or two tabs. \newline % Row Count 21 (+ 3) `1. Open the file.` \newline % Row Count 22 (+ 1) `2. Find the following code block on line 21:` \newline % Row Count 23 (+ 1) ` \textless{}html\textgreater{}` \newline % Row Count 24 (+ 1) ` \textless{}head\textgreater{}` \newline % Row Count 25 (+ 1) ` \textless{}title\textgreater{}Test\textless{}/title\textgreater{}` \newline % Row Count 26 (+ 1) ` \textless{}/head\textgreater{}` \newline % Row Count 27 (+ 1) `3. Update the title to match the name of your website.` \newline % Row Count 29 (+ 2) {\bf{Images}} \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Adding Elements in Lists (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{`1. Open the file containing the Linux mascot.` \newline % Row Count 1 (+ 1) `2. Marvel at its beauty.` \newline % Row Count 2 (+ 1) `\{\{lang-markdown\}\} !{[}Tux, the Linux mascot{]}(/assets/images/tux.png)` \newline % Row Count 4 (+ 2) `3. Close the file.` \newline % Row Count 5 (+ 1) {\bf{Lists}} \newline % Row Count 6 (+ 1) You can nest an unordered list in an ordered list, or vice versa. \newline % Row Count 8 (+ 2) `\{\{lang-markdown\}\}1. First item` \newline % Row Count 9 (+ 1) `\{\{lang-markdown\}\}2. Second item` \newline % Row Count 10 (+ 1) `\{\{lang-markdown\}\}3. Third item` \newline % Row Count 11 (+ 1) `\{\{lang-markdown\}\} - Indented item` \newline % Row Count 12 (+ 1) `\{\{lang-markdown\}\} - Indented item` \newline % Row Count 13 (+ 1) `\{\{lang-markdown\}\}4. Fourth item`% Row Count 14 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Bold}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To bold text, add two asterisks or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters. \newline % Row Count 4 (+ 4) `I just love **bold text**.` \newline % Row Count 5 (+ 1) `I just love \_\_bold text\_\_.` \newline % Row Count 6 (+ 1) `Love**is**bold`% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Markdown applications don't agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold the middle of a word for emphasis.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Italic}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To italicize text, add one asterisk or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters. \newline % Row Count 4 (+ 4) `Italicized text is the *cat's meow*.` \newline % Row Count 5 (+ 1) `Italicized text is the \_cat's meow\_.` \newline % Row Count 6 (+ 1) `A*\textbackslash{}cat*meow.`% Row Count 7 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Markdown applications don't agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to italicize the middle of a word for emphasis.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Bold and Italic}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To emphasize text with bold and italics at the same time, add three asterisks or underscores before and after a word or phrase. To bold and italicize the middle of a word for emphasis, add three asterisks without spaces around the letters. \newline % Row Count 5 (+ 5) `This text is ***really important***.` \newline % Row Count 6 (+ 1) `This text is \_\_\_really important\_\_\_.` \newline % Row Count 7 (+ 1) `This text is \_\_*really important*\_\_.` \newline % Row Count 8 (+ 1) `This text is **\_really important\_**.` \newline % Row Count 9 (+ 1) `This is \seqsplit{really***very***important} text.`% Row Count 10 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The order of the em and strong tags might be reversed depending on the Markdown processor you're using. \newline \newline Markdown applications don't agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold and italicize the middle of a word for emphasis.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Blockquote}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create a blockquote, add a `\textgreater{}` in front of a paragraph. \newline % Row Count 2 (+ 2) `\textgreater{} This is a blockquote.` \newline % Row Count 3 (+ 1) {\bf{Blockquotes with Multiple Paragraphs}} \newline % Row Count 4 (+ 1) Blockquotes can contain multiple paragraphs. Add a `\textgreater{}` on the blank lines between the paragraphs. \newline % Row Count 6 (+ 2) `\textgreater{} This is a blockquote.` \newline % Row Count 7 (+ 1) `\textgreater{}` \newline % Row Count 8 (+ 1) `\textgreater{} Continuation of the blockquote.` \newline % Row Count 9 (+ 1) {\bf{Nested Blockquotes}} \newline % Row Count 10 (+ 1) Blockquotes can be nested. Add a `\textgreater{}\textgreater{}` in front of the paragraph you want to nest. \newline % Row Count 12 (+ 2) `\textgreater{} This is a blockquote.` \newline % Row Count 13 (+ 1) `\textgreater{}` \newline % Row Count 14 (+ 1) `\textgreater{}\textgreater{} This is a nested blockquote` \newline % Row Count 15 (+ 1) {\bf{Blockquotes with Other Elements}} \newline % Row Count 16 (+ 1) Blockquotes can contain other Markdown formatted elements. Not all elements can be used — you'll need to experiment to see which ones work. \newline % Row Count 19 (+ 3) `\textgreater{} \#\#\#\# Blockquote with heading!` \newline % Row Count 20 (+ 1) `\textgreater{}` \newline % Row Count 21 (+ 1) `\textgreater{} - List item inside blockquote.` \newline % Row Count 22 (+ 1) `\textgreater{} - List item inside blockquote.` \newline % Row Count 23 (+ 1) `\textgreater{}` \newline % Row Count 24 (+ 1) `\textgreater{} *Italic* and **bold** are also available.`% Row Count 26 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{For compatibility, put blank lines before and after blockquotes.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Horizontal Rules}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{To create a horizontal rule, use three or more asterisks (`***`), dashes (`-{}-{}-`), or underscores (`\_\_\_`) on a line by themselves. \newline % Row Count 3 (+ 3) `***` \newline % Row Count 4 (+ 1) `-{}-{}-` \newline % Row Count 5 (+ 1) `\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_`% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{For compatibility, put blank lines before and after horizontal rules.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}