aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/index.md
blob: c5816a811ea5d1c3bce78c08273431718ab0a72c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: Markdown on sourcehut
---

Across the site, sr.ht uses [mistletoe][] for rendering Markdown.  It
implements [CommonMark][], which is much more well-defined than the
original Markdown specification.

Additionally, some extensions to CommonMark are used.

* Plain link URLs (of the form `<scheme>://<path>`) and plain e-mail
  addresses (of the form `<name>@<domain>`) can be used, and they will
  be turned into the appropriate links (for e-mail addresses, this
  prepends `mailto:`).

[mistletoe]: https://github.com/miyuchina/mistletoe
[Commonmark]: https://spec.commonmark.org

## Post-processing

Rendered HTML is post-processed so that it only consists the following
tags and attributes (in the format `tags...: attributes...`)

- `a`: `href`, `title`
- `abbr`: `title`
- `acronym`: `title`
- `b`
- `blockquote`
- `code`
- `dd`
- `div`
- `dl`
- `dt`
- `em`
- `h1`, `h2`, `h3`, `h4`, `h5`, `h6`: `id`
- `i`
- `img`: `alt`, `height`, `width`, `src` (only HTTP/HTTPS/local URLs)
- `input`: `type=checkbox`, `checked`, `disabled`
- `li`
- `ol`
- `p`
- `pre`
- `q`
- `span`
- `strong`
- `table`
- `tbody`
- `td`
- `th`
- `thead`
- `tr`
- `ul`

All tags can have the attributes `class`, `style`, `colspan` and
`rowspan`. The only allowed classes are `row`, `col-md-*`, and
`form-control`.

Here are valid `style` attributes:

- `margin`
- `padding`
- `text-align`
- `font-weight`
- `text-decoration`
- `padding-{left,right,bottom,top}`
- `margin-{left,right,bottom,top}`