{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Markdown cheatsheet\n", "\n", "**Adapted from [https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)**\n", "\n", "This is intended as a quick reference and showcase. For more complete info, see [John Gruber\u0027s original spec](http://daringfireball.net/projects/markdown/) and the [Github-flavored Markdown info page](http://github.github.com/github-flavored-markdown/).\n", "\n", "### Table of Contents\n", "\n", "* [Markdown cheatsheet](#markdown-cheatsheet)\n", "\n", " * [Table of Contents](#table-of-contents)\n", " \n", "\n", "* [Headers](#headers)\n", "\n", "* [H1](#h1)\n", "\n", " * [H2](#h2)\n", " \n", " * [H3](#h3)\n", " \n", " * [H4](#h4)\n", " \n", " * [H5](#h5)\n", " \n", " * [H6](#h6)\n", " \n", " \n", " \n", " \n", " \n", "\n", "* [Alt-H1](#alt-h1)\n", "\n", " * [Alt-H2](#alt-h2)\n", " \n", " * [Emphasis](#emphasis)\n", " \n", " * [Lists](#lists)\n", " \n", " * [Links](#links)\n", " \n", " * [Images](#images)\n", " \n", " * [Code and Syntax Highlighting](#code-and-syntax-highlighting)\n", " \n", " * [Tables](#tables)\n", " \n", " * [Blockquotes](#blockquotes)\n", " \n", " * [Inline HTML](#inline-html)\n", " \n", " * [Horizontal Rule](#horizontal-rule)\n", " \n", " * [Line Breaks](#line-breaks)\n", " \n", " * [YouTube Videos](#youtube-videos)\n", " \n", "\n", "## Headers\n", "\n", "```no-highlight\n", "# H1\n", "## H2\n", "### H3\n", "#### H4\n", "##### H5\n", "###### H6\n", "\n", "Alternatively, for H1 and H2, an underline-ish style:\n", "\n", "Alt-H1\n", "======\n", "\n", "Alt-H2\n", "------\n", "```\n", "\n", "# H1\n", "\n", "## H2\n", "\n", "### H3\n", "\n", "#### H4\n", "\n", "##### H5\n", "\n", "###### H6\n", "\n", "Alternatively, for H1 and H2, an underline-ish style:\n", "\n", "# Alt-H1\n", "\n", "## Alt-H2\n", "\n", "## Emphasis\n", "\n", "```no-highlight\n", "Emphasis, aka italics, with *asterisks* or _underscores_.\n", "\n", "Strong emphasis, aka bold, with **asterisks** or __underscores__.\n", "\n", "Combined emphasis with **asterisks and _underscores_**.\n", "\n", "Strikethrough uses two tildes. ~~Scratch this.~~\n", "```\n", "\n", "Emphasis, aka italics, with **asterisks** or **underscores**.\n", "\n", "Strong emphasis, aka bold, with **asterisks** or **underscores**.\n", "\n", "Combined emphasis with **asterisks and **underscores****.\n", "\n", "Strikethrough uses two tildes. ~~Scratch this.~~\n", "\n", "## Lists\n", "\n", "(In this example, leading and trailing spaces are shown with with dots: ⋅)\n", "\n", "```no-highlight\n", "1. First ordered list item\n", "2. Another item\n", "⋅⋅* Unordered sub-list. \n", "1. Actual numbers don\u0027t matter, just that it\u0027s a number\n", "⋅⋅1. Ordered sub-list\n", "4. And another item.\n", "\n", "⋅⋅⋅You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we\u0027ll use three here to also align the raw Markdown).\n", "\n", "⋅⋅⋅To have a line break without a paragraph, you will need to use two trailing spaces.⋅⋅\n", "⋅⋅⋅Note that this line is separate, but within the same paragraph.⋅⋅\n", "⋅⋅⋅(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)\n", "\n", "* Unordered list can use asterisks\n", "- Or minuses\n", "+ Or pluses\n", "```\n", "\n", "0 First ordered list item\n", " \n", "\n", "1 Another item\n", " \n", "\n", " * Unordered sub-list.\n", " \n", " \n", "\n", "2 Actual numbers don\u0027t matter, just that it\u0027s a number\n", " \n", "\n", " 0 Ordered sub-list\n", " \n", " \n", "\n", "3 And another item.\n", " \n", "\n", " You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we\u0027ll use three here to also align the raw Markdown).\n", " \n", "\n", " To have a line break without a paragraph, you will need to use two trailing spaces.\n", "Note that this line is separate, but within the same paragraph.\n", "(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)\n", " \n", "\n", "4 Unordered list can use asterisks\n", " \n", "\n", "5 Or minuses\n", " \n", "\n", "6 Or pluses\n", " \n", "\n", "## Links\n", "\n", "There are two ways to create links.\n", "\n", "```no-highlight\n", "[I\u0027m an inline-style link](https://www.google.com)\n", "\n", "[I\u0027m an inline-style link with title](https://www.google.com \"Google\u0027s Homepage\")\n", "\n", "[I\u0027m a reference-style link][Arbitrary case-insensitive reference text]\n", "\n", "[I\u0027m a relative reference to a repository file](../blob/master/LICENSE)\n", "\n", "[You can use numbers for reference-style link definitions][1]\n", "\n", "Or leave it empty and use the [link text itself].\n", "\n", "URLs and URLs in angle brackets will automatically get turned into links. \n", "http://www.example.com or \u003chttp://www.example.com\u003e and sometimes \n", "example.com (but not on Github, for example).\n", "\n", "Some text to show that the reference links can follow later.\n", "\n", "[arbitrary case-insensitive reference text]: https://www.mozilla.org\n", "[1]: http://slashdot.org\n", "[link text itself]: http://www.reddit.com\n", "```\n", "\n", "[I\u0027m an inline-style link](https://www.google.com)\n", "\n", "[I\u0027m an inline-style link with title](https://www.google.com)\n", "\n", "[I\u0027m a reference-style link]([Arbitrary case-insensitive reference text])\n", "\n", "[I\u0027m a relative reference to a repository file](../blob/master/LICENSE)\n", "\n", "[You can use numbers for reference-style link definitions](http://slashdot.org)\n", "\n", "Or leave it empty and use the [link text itself](http://www.reddit.com).\n", "\n", "URLs and URLs in angle brackets will automatically get turned into links.\n", "[http://www.example.com](http://www.example.com) or [http://www.example.com](http://www.example.com) and sometimes\n", "example.com (but not on Github, for example).\n", "\n", "Some text to show that the reference links can follow later.\n", "\n", "## Images\n", "\n", "```no-highlight\n", "Here\u0027s our logo (hover to see the title text):\n", "\n", "Inline-style: \n", "![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png \"Logo Title Text 1\")\n", "\n", "Reference-style: \n", "![alt text][logo]\n", "\n", "[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png \"Logo Title Text 2\"\n", "```\n", "\n", "Here\u0027s our logo (hover to see the title text):\n", "\n", "Inline-style:\n", "![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png)\n", "\n", "## Code and Syntax Highlighting\n", "\n", "Code blocks are part of the Markdown spec, but syntax highlighting isn\u0027t. However, many renderers -- like Github\u0027s and **FSharp.Formatting** -- support syntax highlighting. Which languages are supported and how those language names should be written will vary from renderer to renderer.\n", "\n", "```no-highlight\n", "Inline `code` has `back-ticks around` it.\n", "```\n", "\n", "Inline `code` has `back-ticks around` it.\n", "\n", "Blocks of code are either fenced by lines with three back-ticks \u003ccode\u003e```\u003c/code\u003e, or are indented with four spaces. I recommend only using the fenced code blocks -- they\u0027re easier and only they support syntax highlighting.\n", "\n", "Currently, only F# and C# syntax highlighting is supported by FSharp.Formatting. You can write code blocks in markdown like this\n", "\n", "F#:\n", "\n" ] } , { "cell_type": "code", "metadata": { "dotnet_interactive": { "language": "fsharp" }, "polyglot_notebook": { "kernelName": "fsharp" } }, "execution_count": null, "outputs": [], "source": [ "\u003cpre\u003e\n", "\u003ccode\u003e```fsharp\u003c/code\u003e\n", "let a = 42\n", "\u003ccode\u003e```\u003c/code\u003e\n", "\u003c/pre\u003e\n" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "```fsharp\n", "let a = 42\n", "```\n", "\n", "Or C#:\n", "\n" ] } , { "cell_type": "code", "metadata": { "dotnet_interactive": { "language": "fsharp" }, "polyglot_notebook": { "kernelName": "fsharp" } }, "execution_count": null, "outputs": [], "source": [ "\u003cpre\u003e\n", "\u003ccode\u003e```csharp\u003c/code\u003e\n", "var a = 42\n", "\u003ccode\u003e```\u003c/code\u003e\n", "\u003c/pre\u003e\n" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "```csharp\n", "var a = 42\n", "```\n", "\n", "FSharp.Formatting will also attempt to highlight snippets that are not in those languages, which will have mixed results\n", "\n" ] } , { "cell_type": "code", "metadata": { "dotnet_interactive": { "language": "fsharp" }, "polyglot_notebook": { "kernelName": "fsharp" } }, "execution_count": null, "outputs": [], "source": [ "\u003cpre\u003e\n", "\u003ccode\u003e```javascript\u003c/code\u003e\n", "var s = \"JavaScript syntax highlighting\";\n", "alert(s);\n", "\u003ccode\u003e```\u003c/code\u003e\n", "\u003c/pre\u003e\n" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "```javascript\n", "const a = 2\n", "var s = \"JavaScript syntax highlighting? not really.\";\n", "alert(s);\n", "// Some javascript keywords that are not detected because they are no equivalents in F#/C#:\n", "native\n", "throws\n", "instanceof\n", "```\n", "\n", "However, there is way better syntax highlighting and also tooltips available for F# and C# if you use script files for generating those docs instead. See an F# example [here](1_fsharp-code-example.html).\n", "\n", "## Tables\n", "\n", "Tables aren\u0027t part of the core Markdown spec, but FSharp.Formatting supports them. Tables are styled via bulma striped table style.\n", "\n", "```no-highlight\n", "Colons can be used to align columns.\n", "\n", "| Tables | Are | Cool |\n", "| ------------- |:-------------:| -----:|\n", "| col 3 is | right-aligned | $1600 |\n", "| col 2 is | centered | $12 |\n", "| zebra stripes | are neat | $1 |\n", "\n", "There must be at least 3 dashes separating each header cell.\n", "The outer pipes (|) are optional, and you don\u0027t need to make the \n", "raw Markdown line up prettily. You can also use inline Markdown.\n", "\n", "Markdown | Less | Pretty\n", "--- | --- | ---\n", "*Still* | `renders` | **nicely**\n", "1 | 2 | 3\n", "```\n", "\n", "Colons can be used to align columns.\n", "\n", "Tables | Are | Cool\n", "--- | :---: | ---:\n", "col 3 is | right-aligned | $1600\n", "col 2 is | centered | $12\n", "zebra stripes | are neat | $1\n", "\n", "\n", "There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don\u0027t need to make the raw Markdown line up prettily. You can also use inline Markdown.\n", "\n", "Markdown | Less | Pretty\n", "--- | --- | ---\n", "**Still** | `renders` | **nicely**\n", "1 | 2 | 3\n", "\n", "\n", "## Blockquotes\n", "\n", "```no-highlight\n", "\u003e Blockquotes are very handy in email to emulate reply text.\n", "\u003e This line is part of the same quote.\n", "\n", "Quote break.\n", "\n", "\u003e This is a very long line that will still be quoted properly when it wraps. Oh boy let\u0027s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. \n", "```\n", "\n", "\u003e Blockquotes are very handy in email to emulate reply text.\n", "This line is part of the same quote.\n", "\u003e \n", "\n", "Quote break.\n", "\n", "\u003e This is a very long line that will still be quoted properly when it wraps. Oh boy let\u0027s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can **put** **Markdown** into a blockquote.\n", "\u003e \n", "\n", "## Inline HTML\n", "\n", "You can also use raw HTML in your Markdown, and it\u0027ll mostly work pretty well.\n", "\n", "```no-highlight\n", "\u003cdl\u003e\n", " \u003cdt\u003eDefinition list\u003c/dt\u003e\n", " \u003cdd\u003eIs something people use sometimes.\u003c/dd\u003e\n", "\n", " \u003cdt\u003eMarkdown in HTML\u003c/dt\u003e\n", " \u003cdd\u003eDoes *not* work **very** well. Use HTML \u003cem\u003etags\u003c/em\u003e.\u003c/dd\u003e\n", "\u003c/dl\u003e\n", "```\n", "\n" ] } , { "cell_type": "code", "metadata": { "dotnet_interactive": { "language": "fsharp" }, "polyglot_notebook": { "kernelName": "fsharp" } }, "execution_count": null, "outputs": [], "source": [ "\u003cdl\u003e\n", " \u003cdt\u003eDefinition list\u003c/dt\u003e\n", " \u003cdd\u003eIs something people use sometimes.\u003c/dd\u003e\n" ] } , { "cell_type": "markdown", "metadata": {}, "source": [ "\u003cdt\u003eMarkdown in HTML\u003c/dt\u003e\n", "\u003cdd\u003eDoes **not** work **very** well. Use HTML \u003cem\u003etags\u003c/em\u003e.\u003c/dd\u003e\n", "\u003c/dl\u003e\n", "\n", "## Horizontal Rule\n", "\n", "```\n", "Three or more...\n", "\n", "---\n", "\n", "Hyphens\n", "\n", "***\n", "\n", "Asterisks\n", "\n", "___\n", "\n", "Underscores\n", "```\n", "\n", "Three or more...\n", "\n", "-----------------------\n", "\n", "Hyphens\n", "\n", "-----------------------\n", "\n", "Asterisks\n", "\n", "-----------------------\n", "\n", "Underscores\n", "\n", "## Line Breaks\n", "\n", "My basic recommendation for learning how line breaks work is to experiment and discover -- hit \u0026lt;Enter\u0026gt; once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You\u0027ll soon learn to get what you want. \"Markdown Toggle\" is your friend.\n", "\n", "Here are some things to try out:\n", "\n", "```\n", "Here\u0027s a line for us to start with.\n", "\n", "This line is separated from the one above by two newlines, so it will be a *separate paragraph*.\n", "\n", "This line is also a separate paragraph, but...\n", "This line is only separated by a single newline, so it\u0027s a separate line in the *same paragraph*.\n", "```\n", "\n", "Here\u0027s a line for us to start with.\n", "\n", "This line is separated from the one above by two newlines, so it will be a **separate paragraph**.\n", "\n", "This line is also begins a separate paragraph, but...\n", "This line is only separated by a single newline, so it\u0027s a separate line in the **same paragraph**.\n", "\n", "## YouTube Videos\n", "\n", "They can\u0027t be added directly but you can add an image with a link to the video like this:\n", "\n", "```no-highlight\n", "\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=YOUTUBE_VIDEO_ID_HERE\n", "\" target=\"_blank\"\u003e\u003cimg src=\"http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg\" \n", "alt=\"IMAGE ALT TEXT HERE\" width=\"240\" height=\"180\" border=\"10\" /\u003e\u003c/a\u003e\n", "```\n", "\n", "Or, in pure Markdown, but losing the image sizing and border:\n", "\n", "```no-highlight\n", "[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)\n", "```\n", "\n", "-----------------------\n", "\n", "License: [CC-BY](https://creativecommons.org/licenses/by/3.0/)\n", "\n" ] } ], "metadata": { "kernelspec": { "display_name": ".NET (F#)", "language": "F#", "name": ".net-fsharp" }, "language_info": { "file_extension": ".fs", "mimetype": "text/x-fsharp", "name": "polyglot-notebook", "pygments_lexer": "fsharp" }, "polyglot_notebook": { "kernelInfo": { "defaultKernelName": "fsharp", "items": [ { "aliases": [], "languageName": "fsharp", "name": "fsharp" } ] } } }, "nbformat": 4, "nbformat_minor": 2 }