-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.limp
252 lines (163 loc) · 5.75 KB
/
README.limp
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
Limp\: the lightweight and extensible document markup language
==============================================================
:ref(https\://github.com/frodo821/limp/actions/workflows/run_automated_tests.yml)::image(https\://github.com/frodo821/limp/actions/workflows/run_automated_tests.yml/badge.svg, alt=Run Automated Tests):;;
Limp is a lightweight markup language for creating documents.
Table of Contents
-----------------
::list~
::item~
:ref(#intro)::underlined:Introduction;;
:label(intro):Introduction;
---------------------------
Limp has only 3 basic rules to markup a document\:
::list~
::item~
:ref(#heading):Heading;
::item~
:ref(#roles):Inline Roles;
::item~
:ref(#block-roles):Block Roles;
Roles are the essential part of limp\: they mark a text how it means in the document.
For instance, the :*code:ref; role indicates the text is a (hyper-)reference,
and the :*code:label; role denotes the text is a significant point in the document and may be referred to.
:label(heading):Heading;
************************
Limp has four levels of headings\:
::*code~
Heading 1
=========
Heading 2
---------
Heading 3
*********
Heading 4
#########
Those are compiled to\:
::*code~
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
:*code:h5; and :*code:h6; are not supported.
But you can add your own custom headings by adding custom roles and renderers.
:label(roles):Inline Roles;
***************************
:bold:Inline role; is a way to mark a text with a role.
A text segment like :*code::bold:this is bold text;; is a very example of inline role.
Renderers handle inline roles and block roles, and each of the different roles has a very different display.
Note you can make custom renderers and use them in your project to process your document.
:label(block-roles):Block Roles;
********************************
:bold:Block role; is another way to mark a text with a role.
In contrast to inline roles, block roles mark up a chunk of texts.
For example\:
::*code~
::*code~
This is a example of code block.
::list~
::item~
This is a example of list item.
::item~
This is another example of list item.
Blocks are indicated by an indentation consisting of some spaces (code point :*code:0x20;). Note tab characters are not counted and ignored when the limp parser measures the indentation level of a line.
When some "dedents" appear and the indentation level turned to the same or less level as the start of the block, it is the end of the block.
The above example are shown like this\:
::*code~
This is a example of code block.
::list~
::item~
This is a example of list item.
::item~
This is another example of list item.
:label(unparsed-marker):Unparsed Marker;
****************************************
A role or role block can have an :b:unparsed marker;.
You can use this marker to mark a text segment, force the parser not to parse and treat the containing text as plain text.
This functionality shall be helpful with code roles or implementing custom embedded metadata roles.
Example\:
::*code~
::*comment~
code role with unparsed marker:
::*code~
:u:This is a :i:example; of :b:code; block.;
::*comment~
code role without unparsed marker:
::code~
:u:This is a :i:example; of :b:code; block.;
Output\:
::*code~
:u:This is a :i:example; of :b:code; block.;
::code~
:u:This is a :i:example; of :b:code; block.;
:label(default-roles):Default Roles;
------------------------------------
Limp has a default set of some roles\:
::list~
::item~
:ref(#image):Image;
::item~
:ref(#block-code):Block Code;
::item~
:ref(#list):List;
::item~
:ref(#table):Table;
::item~
:ref(#comments):Comments;
::item~
:ref(#block-quote):Block Quote;
::item~
:ref(#details-spoiler):Details/Spoiler;
Here is a complete table of inline roles and their appearance\:
::table~
::th~
:td:Role Name; :td:Output; :td:Aliases; :td:Remarks;
::tr~
:td::*code:bold;; :td::b:text;; :td::*code:b;; :td:;
::tr~
:td::*code:italic;; :td::i:text;; :td::*code:i;; :td:;
::tr~
:td::*code:underlined;; :td::u:text;; :td::*code:u;; :td:;
::tr~
:td::*code:strike;; :td::s:text;; :td::*code:s;; :td:;
::tr~
:td::*code:code;; :td::*code:text;; :td:; :td:code role can also be used as a block role.;
::tr~
:td::*code:label;; :td::label(#test-label)::text;; :td:;
:td:label role can also be used as a block role. It is used to mark a significant point in the document to refer from somewhere.;
::tr~
:td::*code:ref;; :td::ref(#test-label)::text;; :td:; :td:code role can also be used as a block role.;
::tr~
:td::*code:br;; :td:; :td:; :td:this role inserts a line break;
:label(image):Image;
********************
:*code:img; role is a way to embed an image in the document. This role has 3 attributes\:
::table~
::th~
:td:Attribute Name; :td:Description; :td:Required?;
::tr~
:td::*code:src;; :td:The URL of the image.; :td:Yes;
::tr~
:td::*code:alt;; :td:The alternative text of the image.; :td:No;
::tr~
:td::*code:title;; :td:The title of the image.; :td:No;
Example\:
::*code~
:img(image_url)::;
:img(image_url, "alternative text")::;
:img(image_url, "alternative text")::;
:img(image_url, alt="alternative text", title="tooltip text")::;
:label(block-code):Block Code;
******************************
:*code:code; role is a way to embed a code block in the document.
You should use this role with :*code:*; unparsed marker.
Example\:
::*code~
::*code~
# This is a Python code
import sys
print([line.split(','): for line in sys.stdin])
Output\:
::*code~
# This is a Python code
import sys
print([line.split(','): for line in sys.stdin])