-
Notifications
You must be signed in to change notification settings - Fork 1
/
htmltags.go
63 lines (58 loc) · 1.58 KB
/
htmltags.go
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
package md
import (
"github.com/diamondburned/gotk4/pkg/pango"
"github.com/diamondburned/gotkit/gtkutil/textutil"
)
// Tags contains the tag table mapping most Matrix HTML tags to GTK TextTags.
var Tags = textutil.TextTagsMap{
// https://www.w3schools.com/cssref/css_default_values.asp
"h1": HTag(1.35),
"h2": HTag(1.18),
"h3": HTag(1.00),
"h4": HTag(0.91),
"h5": HTag(0.83),
"h6": HTag(0.75),
"em": {"style": pango.StyleItalic},
"i": {"style": pango.StyleItalic},
"strong": {"weight": pango.WeightBold},
"b": {"weight": pango.WeightBold},
"u": {"underline": pango.UnderlineSingle},
"strike": {"strikethrough": true},
"del": {"strikethrough": true},
"sup": {"rise": +6000, "scale": 0.7},
"sub": {"rise": -2000, "scale": 0.7},
"code": {
"family": "Monospace",
"insert-hyphens": false,
},
"caption": {
"weight": pango.WeightLight,
"style": pango.StyleItalic,
"scale": 0.8,
},
// "li": {
// "left-margin": 24, // px
// },
"blockquote": {
"foreground": "#789922",
"left-margin": 12, // px
},
// Not an actual HTML tag.
"htmltag": {
"family": "Monospace",
"foreground": "#808080",
},
// Meta tags.
"_invisible": {"editable": false, "invisible": true},
"_immutable": {"editable": false},
"_emoji": {"scale": EmojiScale},
"_image": {"rise": -2 * pango.SCALE},
"_nohyphens": {"insert-hyphens": false},
}
// HTag creates a new TextTag for the heading with the given scale.
func HTag(scale float64) textutil.TextTag {
return textutil.TextTag{
"scale": scale,
"weight": pango.WeightBold,
}
}