This technical post serves as first ever blog entry, cheat sheet and check for all supported markdown features I could implement.
I write markdown files using Typora as md editor, save them on the server and log an entry with metadata (title, filename, date, tags...) on a JSON file. Before uploading I run a script that, among other things, renders the markdown text into HTML. Since I found very good packages in JS, I'm using that language on top of node.js as package manager, called through subprocess via the main python script.
The recipes part works differently. Since I am writing in plain text with custom styling, I need to run a python script for the ingredients/nutrition calculation, and the structure between recipes is shared, I'm storing the HTML files directly.
The projects part is by definition very diverse so I'm keeping it as a simple grid with links to either videos, completely different pages or nothing at all. It relies on JS to bring up the content, but I'm planning on at least statically typing the links to each project beforehand so they are visible to crawlers.
β οΈ Rendered using πmarkdown-it plus several other add-ons:
From here, this entry is for my own use, as I need to have a template when writing new articles. Of course you are free to read on to see what's possible to do with MD, and everything is public so you can see how to do it.
Markdown doesn't natively support this feature! Available: center, left, right, justify
Usage:
::: center
Contents to align center
:::
Contents to align center
Inline:
$$\sqrt{3x-1}+(1+x)^2$$
3xβ1β+(1+x)2
Small block:
$$
\sqrt{3x-1}+(1+x)^2
$$
Block:
$$
\begin{array}{ccc}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &
= \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{array}
$$
Small block:
3xβ1β+(1+x)2
Block:
βΓBβc1ββtβEββΓE+c1ββtβBβββ Bβ=c4Οβjβββ E=0=0β=4ΟΟ
Not showing h1 because it's of the same size as the header of every section so far.
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
Alternatively, for H1 and H2, an underline-ish style:
My philosophy for headers is, h1 for chapters, h2 for sections (unless there are no chapters), h3 for subsections and I wouldn't use the other 3 with any organizational idea behind.
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
**This is bold text**
__This is bold text__
*This is italic text*
_This is italic text_
~~Strikethrough~~
Emphasis, aka italics, with asterisks or underscores.
Strong emphasis, aka bold, with asterisks or underscores.
Combined emphasis with asterisks and underscores.
Strikethrough uses two tildes. Scratch this.
This is bold text
This is bold text
This is italic text
This is italic text
Strikethrough
1. First ordered list item
2. Another item
β
β
* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
β
β
1. Ordered sub-list
4. And another item.
β
β
β
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
β
β
β
To have a line break without a paragraph, you will need to use two trailing spaces.β
β
β
β
β
Note that this line is separate, but within the same paragraph.β
β
β
β
β
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
1. Make my changes
1. Fix bug
2. Improve formatting
- Make the headings bigger
2. Push my commits to GitHub
3. Open a pull request
* Describe my changes
* Mention all the members of my team
* Ask for feedback
β β β You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
β β β To have a line break without a paragraph, you will need to use two trailing spaces.β β β β β Note that this line is separate, but within the same paragraph.β β β β β (This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
* Unordered list can use asterisks
- Or minuses
+ Or pluses
+ Create a list by starting a line with `+`, `-`, or `*`
+ Sub-lists are made by indenting 2 spaces:
- Marker character change forces new list start:
* Ac tristique libero volutpat at
+ Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
+ Very easy!
Or pluses
Create a list by starting a line with +
, -
, or *
Sub-lists are made by indenting 2 spaces:
Very easy!
- [x] Finish my changes
- [ ] Push my commits to GitHub
- [ ] Open a pull request
- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item
[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself].
URLs and URLs in angle brackets will automatically get turned into links.
http://www.example.com or <http://www.example.com> and sometimes
example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
I'm an inline-style link with title
I'm a relative reference to a repository file
You can use numbers for reference-style link definitions
Or leave it empty and use the link text itself.
URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or http://www.example.com and sometimes example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
Here's our logo (hover to see the title text):
Inline-style:

Reference-style:
![INLINE][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"


Like links, Images also have a footnote style syntax
![Figure text][id]
With a reference later in the document defining the URL location:
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
Here's our logo (hover to see the title text):
Inline-style:
Reference-style:
Like links, Images also have a footnote style syntax
With a reference later in the document defining the URL location:
Footnote documentation
Footnote 1 link[^first].
Footnote 2 link[^second].
Inline footnote^[Text of inline footnote] definition.
Duplicated footnote reference[^second].
[^first]: Footnote **can have markup**
and multiple paragraphs.
[^second]: Footnote text.
Footnote 1 link[1].
Footnote 2 link[2].
Inline footnote[3] definition.
Duplicated footnote reference[2:1].
<iframe width="640" height="360" src="https://www.youtube.com/embed/WO2b03Zdu4Q" allowfullscreen></iframe>
You can force the interpreter to ignore or escape Markdown formatting by using \ before the Markdown character.
Let's rename \*our-new-project\* to \*our-old-project\*.
Let's rename *our-new-project* to *our-old-project*.
Inline `code` has `back-ticks around` it.
Inline code
has back-ticks around
it.
using System.IO.Compression;
#pragma warning disable 414, 3021
namespace MyApplication
{
[Obsolete("...")]
class Program : IInterface
{
public static List<int> JustDoIt(int count)
{
Console.WriteLine({{content}}quot;Hello {Name}!");
return new List<int>(new int[] { 1, 2, 3 })
}
}
}
@font-face {
font-family: Chunkfive; src: url('Chunkfive.otf');
}
body, .usertext {
color: #F0F0F0; background: #600;
font-family: Chunkfive, sans;
}
@import url(print.css);
@media print {
a[href^=http]::after {
content: attr(href)
}
}
function $initHighlight(block, cls) {
try {
if (cls.search(/\bno\-highlight\b/) != -1)
return process(block, true, 0x0F) +
` class="${cls}"`;
} catch (e) {
/* handle exception */
}
for (var i = 0 / 2; i < classes.length; i++) {
if (checkCondition(classes[i]) === undefined)
console.log('undefined');
}
}
export $initHighlight;
require_once 'Zend/Uri/Http.php';
namespace Location\Web;
interface Factory
{
static function _factory();
}
abstract class URI extends BaseURI implements Factory
{
abstract function test();
public static $st1 = 1;
const ME = "Yo";
var $list = NULL;
private $var;
/**
* Returns a URI
*
* @return URI
*/
static public function _factory($stats = array(), $uri = 'http')
{
echo __METHOD__;
$uri = explode(':', $uri, 0b10);
$schemeSpecific = isset($uri[1]) ? $uri[1] : '';
$desc = 'Multi
line description';
// Security check
if (!ctype_alnum($scheme)) {
throw new Zend_Uri_Exception('Illegal scheme');
}
$this->var = 0 - self::$st;
$this->list = list(Array("1"=> 2, 2=>self::ME, 3 => \Location\Web\URI::class));
return [
'uri' => $uri,
'value' => null,
];
}
}
echo URI::ME . URI::$st1;
__halt_compiler () ; datahere
datahere
datahere */
datahere
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
Example with multirows
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| #rowspan=2 col 3 is | right-aligned | $1600 |
| #remove | centered | $12 |
| zebra stripes | are neat | $1 |
Example with multicols
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| #colspan=2 zebra stripes are neat | #remove | $1 |
There must be at least 3 dashes separating each header cell.
The outer pipes (|) are optional, and you don't need to make the
raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3
| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |
| Command | Description |
| --- | --- |
| git status | List all new or modified files |
| git diff | Show file differences that haven't been staged |
| Command | Description |
| --- | --- |
| `git status` | List all *new or modified* files |
| `git diff` | Show file differences that **haven't been** staged |
| Left-aligned | Center-aligned | Right-aligned |
| :--- | :---: | ---: |
| git status | git status | git status |
| git diff | git diff | git diff |
| Name | Character |
| --- | --- |
| Backtick | ` |
| Pipe | \| |
Colons can be used to align columns.
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |
Example with multirows
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
centered | $12 | |
zebra stripes | are neat | $1 |
Example with multicols
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes are neat | $1 |
There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty |
---|---|---|
Still | renders |
nicely |
1 | 2 | 3 |
First Header | Second Header |
---|---|
Content Cell | Content Cell |
Content Cell | Content Cell |
Command | Description |
---|---|
git status | List all new or modified files |
git diff | Show file differences that haven't been staged |
Command | Description |
---|---|
git status |
List all new or modified files |
git diff |
Show file differences that haven't been staged |
Left-aligned | Center-aligned | Right-aligned |
---|---|---|
git status | git status | git status |
git diff | git diff | git diff |
Name | Character |
---|---|
Backtick | ` |
Pipe | | |
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
> Blockquotes can also be nested...
>> ...by using additional greater-than signs right next to each other...
> > > ...or with spaces between arrows.
Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.
Quote break.
This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.
Blockquotes can also be nested...
...by using additional greater-than signs right next to each other...
...or with spaces between arrows.
Three or more...
---
Hyphens
***
Asterisks
___
Underscores
Three or more...
Hyphens
Asterisks
Underscores