File: markdown

package info (click to toggle)
dte 1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,152 kB
  • sloc: ansic: 28,421; sh: 94; awk: 56; makefile: 13; sed: 1
file content (181 lines) | stat: -rw-r--r-- 3,588 bytes parent folder | download
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
syntax .markdown-escape

state char special
    char !-/:-@[-`{-~ END special
    recolor text 1
    noeat END

syntax .markdown-fenced-code-block

state body code-block
    char "\n" line-start
    eat this

state line-start code-block
    heredocend end
    noeat body

state end code-block
    char "\n" END
    noeat body

syntax markdown

# TODO: All variations of links and references
# TODO: Underlined headings

state file-start
    str -- "---\n" yaml
    noeat line-start

state yaml
    str -- "---\n" line-start yaml
    str "...\n" line-start yaml
    eat this

state line-start
    char "\n" block-start
    char " " this
    char # hash-heading
    char > block-quote
    char [ maybe-link-def
    char -b 0-9 digit
    str "**" double-asterisk
    str '__' double-underscore
    char * bullet-asterisk emphasis
    char _ underscore
    char +- bullet
    char -b "~" tilde
    char -b "`" backtick
    noeat text

state block-start
    str "    " code-block
    char "\t" code-block
    char "\n " this
    noeat line-start

state text
    char "\n" line-start
    char " \t" space
    char '`' code-span
    char [ reference
    str '**' double-asterisk
    char * asterisk
    char "\\" .markdown-escape:this
    eat this

# Underscores only begin emphasis if preceded by whitespace.
# This is to avoid mis-highlighting intra-word underscores
# as emphasis (e.g. "x86_64").
state space
    char " \t" this
    str '__' double-underscore
    char _ underscore
    noeat text

state bullet
    char "\n" line-start
    char -n " \t" text
    recolor unordered-list 2
    noeat text

state bullet-asterisk
    char "\n" line-start
    char -n " \t" asterisk emphasis
    recolor unordered-list 2
    noeat text

state code-block
    char "\n" block-start
    eat this

state backtick code-block
    char -b '`' this
    bufis '`' code-span
    bufis '``' text code-span
    heredocbegin .markdown-fenced-code-block line-start

state tilde code-block
    char -b '~' this
    bufis '~' text
    bufis '~~' text
    heredocbegin .markdown-fenced-code-block line-start

state block-quote
    char "\n" line-start
    eat this

state digit
    char "\n" line-start
    char -b 0-9 this
    char -n . text
    recolor ordered-list
    eat text ordered-list

state hash-heading heading
    char "\n" line-start
    eat this

state code-span
    char "\n" line-start
    char ` text code-span
    eat this

state asterisk emphasis
    char * text emphasis
    char -n "\n" this
    noeat line-start

state double-asterisk strong-emphasis
    char "\n" line-start
    str '**' text strong-emphasis
    eat this

state underscore emphasis
    char _ text emphasis
    char -n "\n" this
    noeat line-start

state double-underscore strong-emphasis
    char "\n" line-start
    str '__' text strong-emphasis
    eat this

state reference
    char "\\" .markdown-escape:this
    char ] reference-close reference
    eat this

state reference-close
    char "\n" line-start
#    char ( reference-link
#    char [ reference-pointer
    noeat text

state maybe-link-def reference
    char "\\" .markdown-escape:this
    char ] maybe-link-def-close
    eat this

state maybe-link-def-close reference
    char : link-def reference
    noeat reference-close

state link-def
    char " \t" this
    char "\n" line-start
    noeat link-def-url

state link-def-url url
    char "\n" line-start
    char " \t" link-def-after-url
    eat this

state link-def-after-url text
    char "\n" line-start
    eat this

default comment yaml
default special unordered-list
default numeric ordered-list