UtilitiesMarkdown
Websites are written in HTML, which is a document specification language that supports many embellishments like boldface, italics, numbered lists, links, etc. HTML can be difficult to read directly, however, because the markers are quite obtrusive. Here's a (silly) example to illustrate the point:
Markdown was invented in 2004 by John Gruber and Aaron Swartz as a tool for specifying rich text (boldface, italics, links, etc.) in a plain text file that is easy to read and write. Here's the example above in Markdown:
The *quick* brown fox **jumped** over the lazy `dog`.
Markdown has since become a
Markdown rules
The list of essential Markdown rules is pretty short:
- Boldface is indicated with double underscores or double asterisks:
__This text is bold__
or**This text is bold**
.
- For italics, use underscores or asterisks:
_This text is italic_
or*This text is italic*
.
Headers are indicated with a number of hashmarks followed by a space and the header text. Top-level headers use a single hashmark, and using more hashmarks makes the resulting font size increasingly small
# Top-level title ## Section 1 ### Subsection ## Section 2
- Links use square brackets around the text to be displayed and parentheses around the URL to be linked:
[Click here](http://www.google.com)
.
Images are included using the link syntax preceded by an exclamation point. The contents of the square brackets are used as alt-text (the text that appears if there's an issue loading the image).
![a tiger](https://upload.wikimedia.org/wikipedia/commons/5/56/Tiger.50.jpg)
Blockquotes are marked with a greater-than sign at the beginning of the line:
> "Imagination is more important than knowledge." -Albert Einstein
Bullet lists are achieved with an asterisk and a space at the beginning of each line containing a list item:
* Limits * Differentiation * Integration
Numbered lists use numbers instead of asterisks. Numbers are assigned sequentially when the list is rendered, so you can use 1 for every list item in the source file. For nested lists, indent two spaces:
1. Limits 1. Differentiation 1. Power rule 2. Product rule 3. Chain rule 1. Integration 1. Power rule 1. Substitution 1. Integration-by-parts
Inline code is surrounded by backticks, as in "
try the `sqrt` function
". Code blocks are surrounded by three backticks, with an optional language name following the first set:```python import numpy as np np.sqrt(3) ```
- A single newline character is ignored by default, so that you can break up the lines of a paragraph however you want without affecting the output. To separarate paragraphs, put a blank line between them. To force a line break without a paragraph break, put two spaces just before the newline.
Exercise
Answer each of the following questions about Markdown.
- Code fences are marked using
. - Markdown will automatically correct the numbering in your numbered lists
. - The syntax for inserting an image is an
followed by containing the followed by containing the . - The syntax for inserting links is
containing the followed by containing the . - Inline code is indicated using
. - Section headings are indicated using
followed by a . - For boldface or italics, use
or underscores (or asterisks), respectively .