-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathReadme.gdtxt
304 lines (217 loc) · 9.31 KB
/
Readme.gdtxt
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
«front-matter
|author: Gautam Dey <gautam.dey77@gmail.com>
|date: 10 Oct 2015
|title: My simple document format.
;
»
§ Introduction
§§ What is gdtxt
gdTxt ([_ good enough text format _]) is a plain text format for writing structured documents, based on my
experiences using email, and posting on various sites on the internet using
markdown. This format is my attempt to simplify and remove many of the redundancies in markdown. I plan to provide a full specification and a set of reference documents. The documents will be encoded in [[UTF8][http://utf-8.com]], allowing us to remove the restriction of limiting ourselves to only ASCII characters.
The core idea is that there should be only one representation per concept. Reducing the number of things one has to remember; making the format (in my opinion) easier to use.
§§ Why a spec
The purpose of the specification is to document the format and provide an authoritative answer to how the format behaves unambiguously. If there are any ambiguous parts, those should be considered a [[bug][report-bug]].
§ Preliminaries
§§ Characters and lines
Any sequence of characters is a valid gdTxt document.
A [#[character]] is a Unicode point. Some code points (i.e.,
combining accents) do not correspond to characters in an intuitive sense, all
code points count as characters for this spec.
All gdTxt documents are encoded using [[ utf8 ][http://utf-8.com]].
A [#[ line ]] is a sequence of zero or more characters other than [@ newline ] or
[@ carriage-return ], followed by a [[ line ending ][line-ending]] or by the end
of a file.
«note;
It is preferred that all documents include an extra [[blank line][blank-line]] at
the end of the document
»
A [#[ line ending ][line-ending]] is a [@ newline ].
A line containing no characters, or a line containing only [@ spaces ] or
[@ tabs ], is called a [#[ blank line ][blank-line]]
The following definitions of characters classes will be used in this spec:
A [[ whitespace character ][whitespace-character]] is a [@ space ], [@ tab ],
[@ newline ], [@ line-tabulation ], [@ form-feed ], or [@ carriage-return ].
[#[ Whitespace ]] is a sequence of one or more
[[ whitespace characters ][whitespace-characters]]
A [#[Unicode whitespace character][unicode-whitespace-character]] is any code
point in the Unicode [* Zs *] class, or [@ tab ], [@ carriage-return ],
[@ newline ], or [@ form feed ].
A [#[ space ]] is [@ space-unicode ]
A [#[ non-whitespace character ][non-whitesapce-character]] is any character that
is not a [[ whitespace-character ]].
An [#[ ASCII punctuation character ]] is:
[* ! *], [* " *], [* # *], [* $ *], [* % *], [* ' *], [* ( *], [* ) *], [* * *],
[* + *], [* , *], [* - *], [* . *], [* / *], [* : *], [* ; *], [* < *], [* = *],
[* > *], [* ? *], [* @ *], [* [ *], [* ~ *], [* ] *], [* ^ *], [* _ *], [* ` *],
[* { *], [* | *], [* } *], or [* \\ *]
a [#[ punctuation character ]] is an [[ ASCII punctuation character ]] or anything in
the Unicode classes [* Pc *], [* Pd *], [* Pe *], [* Pf *], [* Po *], or
[* Ps *].
§§ Tabs
Tabs in lines will not be expanded into spaces.
§§ Insecure characters
For security reasons, the Unicode characters [* U+0000 *] [* MUST *] be replaced with the replacement character ([* U+FFFD *]).
§ Inline, Line, and Blocks
§§ Inline
Inline statements are statements that can be placed in line. There should not be any
newline characters inside of an inline statement.
Current inline-elements are:
• emphasize : \[* *\]
• strong : \[** **\]
• strike-through : \[– –\]
• underline : \[_ _\]
• inline call-out: \[` `\]
• inline quote: \[" "\]
• inline raw string [\ [\\\\] \]
no need to escape anything other then \.
Also, note that leading and trailing spaces are not trimmed
• unicode character: \[u0020\]
the value is in hex
• inline code: \[(go:var) corpus \]
the first element in the prens is the language
if there is a colon following the language it will be the language
element type. This is optional. Default is left to the implementation
but should be something that makes sense for that language.
• reference : \[\[ text \]\[ reference \]\]
[[see references for greater detail][references]]
• anchor : \[#\[ text \]\[ reference \]\]
• insert : \[@ reference \]
Insert will insert the value of the reference into the space.
§§§ [#[ References ][ references ]]
A reference is an identifier that can is made up of Letters followed by letters, numbers, [* _ *], [* - *], or [* . *]
§§ Line
Line statements start at the start of a line with an identifier.
# Section line:
A section line starts with ([* U+00A7 *]) and is followed by the title of the section.
The number of sections markers identified the section level, up to six.
# ordered list:
An ordered list starts with # [* (U+0023) *] and is followed the list item.
The list item can have one or more paragraphs or block elements associated with it.
Each paragraph or block element is separated by a blank line or
another list element.
Sub ordered lists are delimited by add additional [* # *] symbols.
Two blank lines terminate the list, or encountering a section header,
or a different list type.
«Note;
One can, also, use 1. and 1.1. etc.. Need to write this part out.
»
# unordered list:
An ordered list is a line that starts with • and is followed by the title of the list item. The list item can have one or more paragraphs or other block elements associated with it. Additional levels are the number of • characters in the front of the list.
Besides if a “•” is followed by [] or [x] it should be treated as a check
list.
# horizontal line:
Three or more “—” at the start of a line will create a horizontal line. Text after the line-markers are ignored.
§§§ Blocks
Every block starts with ‘«’ followed by the block type. Each block has three
parts.
The first part is the block type. This part ends with the first header separator
| or the header block end ‘;’.
The second part is called the header; this is a simple key-value structure. Each
key is separated from the value via a ‘:’; each key-value pair is separated with a
'|'. The header part of a block is terminated with a ';'.
The final part of a block is the body. It is everything till the closing [* » *].
• Quote :
A Quote block allows you to quote some piece of text.
«code
| lang: gdtxt
;
«quote
;
This is a quote
»
»
• Code :
Allow you insert code, provides syntax highlighting and numbering.
Code blocks everything inside of the body part.
«code
| lang: gdtxt
;
«code
| lang : go
;
package main
import ( "fmt" )
func main(){
fmt.Println("Hello world");
}
»
»
• Front-matter :
This element is metadata for the document. There should be only one of these.
One should merge all of them together, with each merge overwriting other elements. The processor should emit a warning each time an overwrite
occurs.
Known attributes:
«block;
• Author: The author is the name of the author in email format i.e.
“display name <email@address>”
• Date: The date the article was written.
• Title: The title of the document. Only the first 160 characters will be taken.
»
«code
| lang: gdtxt
;
«front-matter
| author : Guatam Dey <gautam.dey77@gmail.com>
| date : 10 Oct 2015
| title : My simple document format.
;
»
»
• block :
A block block is a block that allows you to enter some gdTxt text as a
paragraph.
• include :
An include block allows you to add another file or URL, that will be
treated as a gdtxt file and then included in a set of rendered paragraphs
into the section.
• comment :
The render ignores a comment block. It is there to add commentary to the document.
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
• foo bar
•• bar
This is a paragraph
This is another paragraph
«quote
| attribute: Someone
;
The greatest things in life cost something.
»
•• baz
# Foo
## Baz
#• Bar
1. Foo
1.1. baz
1.• bar
§ Section and headers
Sections are delimited using ‘$’ or ‘§’ with no white spaces at the beginning of the
line. There are 6 six section headers.
§ Paragraphs
Paragraphs are consecutive lines of text separated by a [[blank line][blank-line]].
§ Blocks
§§ Quote
«code
|gdTxt
;
«quote
|no-strip
;
Some text here.
Blocks can be nested. for quote block.s
«quote;
This would be the double quote.
»
»
»
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
«refs
| newline : newline ([*U+000A*])
| carriage-return : carriage return ([*U+000D*])
| space-unicode : ([*U+0020*])
| space : space [@space-unicode]
| spaces : spaces [@space-unicode]
;»
«refs
| report-bug: https://github.com/gdey/gdtxt/issues
;»