4 %!includeconf: rules.conf
6 This document describes all the details about each txt2tags mark.
7 The target audience are **experienced** users. You may find it
8 useful if you want to master the marks or solve a specific problem
11 If you are new to txt2tags or just want to know which are the
12 available marks, please read the [Markup Demo MARKUPDEMO].
14 Note 1: This document is generated directly from the txt2tags
15 test-suite. All the rules mentioned here are 100% in sync with the
18 Note 2: A good practice is to consult [the sources rules.t2t] when
19 reading, to see how the texts were made.
25 -------------------------------------------------------------
27 = Paragraph =[paragraph]
29 %INCLUDED(t2t) starts here: ../../../test/marks/paragraph.t2t
32 %%% Syntax: Lines grouped together
33 A paragraph is composed by one or more lines.
34 A blank line (or a table, or a list) ends the
37 %%% Syntax: Leading and trailing spaces are ignored
38 Leading and trailing spaces are ignored.
40 %%% Syntax: A comment don't close a paragraph
41 A comment line can be placed inside a paragraph.
42 % this comment will be ignored
43 It will not affect it.
45 %%% Closing: EOF closes the open paragraph
46 The end of the file (EOF) closes the
47 currently open paragraph.
51 %INCLUDED(t2t) starts here: ../../../test/marks/comment.t2t
54 %%% Syntax: The % character at the line beginning (column 1)
55 %glued with the % mark
56 % separated from the % mark
57 % very distant from the % mark
58 %%%%%%% lots of % marks
59 % a blank comment, used for vertical spacing:
61 % NOTE: what matters is the first % being at the line beginning,
62 % the rest of the line is just ignored.
64 %%% Syntax: Area (block)
66 You're not seeing this.
69 %%% Syntax: Area (block) with trailing spaces
71 You're not seeing this.
74 %%% Invalid: The % in any other position
75 % not on the line beginning (at column 2)
77 some text % half line comments are not allowed
82 %INCLUDED(t2t) starts here: ../../../test/marks/line.t2t
85 %%% Syntax: At least 20 chars of - = _
89 %%% Syntax: Any kind of mixing is allowed
90 %% Free mixing is allowed to make the line,
91 %% but the first char is the identifier for
92 %% the difference between separator ( - _ )
93 %% and strong ( = ) lines.
99 %%% Syntax: Leading and/or trailing spaces are allowed
103 %%% Invalid: Less than 20 chars (but strike matches)
105 %%% Invalid: Strange chars (but strike matches)
110 ( -------------------- )
114 %INCLUDED(t2t) starts here: ../../../test/marks/inline.t2t
117 %%% Syntax: Marks are greedy and must be "glued" with contents
118 %% GLUED: The contents must be glued with the marks, no spaces
119 %% between them. Right after the opening mark there must be a
120 %% non-blank character, as well as right before the closing mark.
122 %% GREEDY: If the contents boundary character is the same as
123 %% the mark character, it is considered contents, not mark.
124 %% So ""****bold****"" turns to ""<B>**bold**</B>"" in HTML.
126 i) **b** //i// __u__ --s-- ``m`` ""r"" ''t''
127 i) **bo** //it// __un__ --st-- ``mo`` ""ra"" ''tg''
128 i) **bold** //ital// __undr__ --strk-- ``mono`` ""raw"" ''tggd''
129 i) **bo ld** //it al// __un dr__ --st rk-- ``mo no`` ""r aw"" ''tg gd''
130 i) **bo * ld** //it / al// __un _ dr__ --st - rk-- ``mo ` no`` ""r " aw"" ''tg ' gd''
131 i) **bo **ld** //it //al// __un __dr__ --st --rk-- ``mo ``no`` ""r ""aw"" ''tg ''gd''
132 i) **bo ** ld** //it // al// __un __ dr__ --st -- rk-- ``mo `` no`` ""r "" aw"" ''tg '' gd''
133 i) ****bold**** ////ital//// ____undr____ ----strk---- ````mono```` """"raw"""" ''''tggd''''
134 i) ***bold*** ///ital/// ___undr___ ---strk--- ```mono``` """raw""" '''tggd'''
136 %%% Syntax: Repetition is greedy
137 %% When the mark character is repeated many times,
138 %% the contents are expanded to the largest possible.
139 %% Thats why they are greedy, the outer marks are
142 i) ***** ///// _____ ----- ````` """"" '''''
143 i) ****** ////// ______ ------ `````` """""" ''''''
144 i) ******* /////// _______ ------- ``````` """"""" '''''''
145 i) ******** //////// ________ -------- ```````` """""""" ''''''''
146 i) ********* ///////// _________ --------- ````````` """"""""" '''''''''
147 i) ********** ////////// __________ ---------- `````````` """""""""" ''''''''''
149 %%% Invalid: No contents
151 i) **** //// ____ ---- ```` """" ''''
152 i) ** ** // // __ __ -- -- `` `` "" "" '' ''
154 %%% Invalid: Contents not "glued" with marks
155 %% Spaces between the marks and the contents in any side
156 %% invalidate the mark.
158 i) ** bold** // ital// __ undr__ -- strk-- `` mono`` "" raw"" '' tggd''
159 i) **bold ** //ital // __undr __ --strk -- ``mono `` ""raw "" ''tggd ''
160 i) ** bold ** // ital // __ undr __ -- strk -- `` mono `` "" raw "" '' tggd ''
164 %INCLUDED(t2t) starts here: ../../../test/marks/link.t2t
170 user@domain.com. any text.
171 any text: user@domain.com. any text.
172 [label user@domain.com]
173 %%% Syntax: E-mail with form data
174 user@domain.com?subject=bla
175 user@domain.com?subject=bla.
176 user@domain.com?subject=bla,
177 user@domain.com?subject=bla&cc=otheruser@domain.com
178 user@domain.com?subject=bla&cc=otheruser@domain.com.
179 user@domain.com?subject=bla&cc=otheruser@domain.com,
180 [label user@domain.com?subject=bla&cc=otheruser@domain.com].
181 [label user@domain.com?subject=bla&cc=otheruser@domain.com.].
183 http://www.domain.com
184 http://www.domain.com/dir/
185 http://www.domain.com/dir///
186 http://www.domain.com.
187 http://www.domain.com,
188 http://www.domain.com. any text.
189 http://www.domain.com, any text.
190 http://www.domain.com/dir/. any text.
191 any text: http://www.domain.com. any text.
192 any text: http://www.domain.com/dir/. any text.
193 any text: http://www.domain.com/dir/index.html. any text.
194 any text: http://www.domain.com/dir/index.html, any text.
195 %%% Syntax: URL with anchor
196 http://www.domain.com/dir/#anchor
197 http://www.domain.com/dir/index.html#anchor
198 http://www.domain.com/dir/index.html#anchor.
199 http://www.domain.com/dir/#anchor. any text.
200 http://www.domain.com/dir/index.html#anchor. any text.
201 any text: http://www.domain.com/dir/#anchor. any text.
202 any text: http://www.domain.com/dir/index.html#anchor. any text.
203 %%% Syntax: URL with form data
204 http://domain.com?a=a@a.a&b=a+b+c.
205 http://domain.com?a=a@a.a&b=a+b+c,
206 http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.
207 http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.
208 %%% Syntax: URL with form data and anchor
209 http://domain.com?a=a@a.a&b=a+b+c.#anchor
210 http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor
211 http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor
212 %%% Syntax: URL with login data
213 http://user:password@domain.com/bla.html.
214 http://user:password@domain.com/dir/.
215 http://user:password@domain.com.
216 http://user:@domain.com.
217 http://user@domain.com.
218 %%% Syntax: URL with login, form and anchor
219 http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor
220 http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor
221 %%% Syntax: URL with label
222 [label www.domain.com]
223 %%% Syntax: URL with label (trailing spaces are discarded, leading are maintained)
224 %TODO normalize this behavior
225 [ label www.domain.com]
226 [label www.domain.com]
227 %%% Syntax: URL with label, stressing
228 [anchor http://www.domain.com/dir/index.html#anchor.]
229 [login http://user:password@domain.com/bla.html]
230 [form http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.]
231 [form & anchor http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor]
232 [login & form http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.]
233 %%% Syntax: Link with label for local files
235 [local link file bla.html]
236 [local link anchor #anchor]
237 [local link file/anchor bla.html#anchor]
238 [local link file/anchor bla.html#anchor.]
239 [local link img abc.gif]
240 %%% Syntax: Another link as a label
241 [www.fake.com www.domain.com]
242 %%% Syntax: URL with funny chars
243 http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm
244 http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-
245 http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%.
246 http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%.
247 %%% Test: Various per line
248 http://L1.com ! L2@www.com ! [L3 www.com] ! [L4 w@ww.com] ! www.L5.com
249 %%% Feature: Guessed link, adding protocol automatically
255 [label www.domain.com]
256 [label ftp.domain.com]
257 [label WWW.DOMAIN.COM]
258 [label FTP.DOMAIN.COM]
259 %%% Invalid: Trailing space on link
260 [label www.domain.com ]
261 %%% Invalid: Label with ] char (use postproc)
262 [label] www.domain.com]
266 %INCLUDED(t2t) starts here: ../../../test/marks/image.t2t
269 %%% Syntax: Image name inside brackets: [img]
272 %%% Syntax: Image pointing to a link: [[img] link]
273 [[img.png] http://txt2tags.org]
275 %%% Align: Image position is preserved when inside paragraph
276 [img.png] Image at the line beginning.
278 Image in the middle [img.png] of the line.
280 Image at the line end. [img.png]
282 %%% Align: Image alone with spaces around is aligned
287 %%% Test: Two glued images with no spaces (left & right)
290 %%% Test: Various per line
291 Images [img.png] mixed [img.png] with [img.png] text.
293 Images glued together: [img.png][img.png][img.png].
295 %%% Invalid: Spaces inside are not allowed
304 %INCLUDED(t2t) starts here: ../../../test/marks/macro.t2t
307 %%% Syntax: Macro without formatting string
308 Date : %%date - %%date()
309 Mtime : %%mtime - %%mtime()
310 Infile : %%infile - %%infile()
311 Outfile : %%outfile - %%outfile()
313 %%% Syntax: Macro name is case insensitive
319 %%% Syntax: Macro with formatting string
320 Date : %%date(txt %C txt)
321 Mtime : %%mtime(txt %C txt)
322 Infile : %%infile(txt %e txt)
323 Outfile : %%outfile(txt %e txt)
325 %%% Syntax: Leading and trailing spaces are preserved
326 Date : (%%date( txt )) - (%%date( %C ))
327 Mtime : (%%mtime( txt )) - (%%mtime( %C ))
328 Infile : (%%infile( txt )) - (%%infile( %e ))
329 Outfile : (%%outfile( txt )) - (%%outfile( %e ))
331 %%% Test: Expansion of the percent char
332 Date : %%date(%) - %%date(%%) - %%date(%%%) - %%date(%%%)
333 Mtime : %%mtime(%) - %%mtime(%%) - %%mtime(%%%) - %%mtime(%%%)
334 Infile : %%infile(%) - %%infile(%%) - %%infile(%%%) - %%infile(%%%)
335 Outfile : %%outfile(%) - %%outfile(%%) - %%outfile(%%%) - %%outfile(%%%)
337 %%% Test: Various per line, glued
338 Date : %%date(%C)%%date%%date
339 Mtime : %%mtime(%C)%%mtime%%mtime
340 Infile : %%infile(%e)%%infile%%infile
341 Outfile : %%outfile(%e)%%outfile%%outfile
343 %%% Test: Path formatters
346 Dirname : %%infile(%d, %D)
347 Dirname : %%outfile(%d, %D)
348 File : %%infile(%F + %e = %f)
349 File : %%outfile(%F + %e = %f)
351 = Numbered Title =[numtitle]
353 See [Title #title], the same rules apply.
357 %INCLUDED(t2t) starts here: ../../../test/marks/title.t2t
360 %%% Syntax: Balanced equal signs (from 1 to 5)
363 === Title Level 3 ===
364 ==== Title Level 4 ====
365 ===== Title Level 5 =====
366 %%% Label: Between brackets, alphanumeric [A-Za-z0-9_-]
367 = Title Level 1 =[lab_el-1]
368 == Title Level 2 ==[lab_el-2]
369 === Title Level 3 ===[lab_el-3]
370 ==== Title Level 4 ====[lab_el-4]
371 ===== Title Level 5 =====[lab_el-5]
372 %%% Syntax: Spaces around and/or inside are allowed (and ignored)
374 === Title Level 3 ===
375 === Title Level 3 ===
376 === Title Level 3 ===
377 === Title Level 3 ===
378 === Title Level 3 ===[lab_el-9]
379 %%% Invalid: Unbalanced equal signs
385 %%% Invalid: Level deeper than 5
386 ======Not Title 6======
388 =======Not Title 7=======
389 %%% Invalid: Space between title and label
391 %%% Invalid: Space inside label
393 %%% Invalid: Strange chars inside label
398 %INCLUDED(t2t) starts here: ../../../test/marks/quote.t2t
401 %%% Syntax: TAB defines quote
402 To quote a paragraph, just prefix it by a TAB
403 character. All the lines of the paragraph must
405 Any non-tabbed line closes the quote block.
407 %%% Nesting: Creating deeper quotes
408 The number of leading TABs identifies the quote
409 block depth. This is quote level 1.
410 With two TABs, we are on the quote
412 The more TABs, more deep is
416 %%% Nesting: Reverse nesting works
419 Then its depth is decreased.
420 Counting down, one by one.
423 %%% Nesting: Random count
424 Unlike lists, any quote block is
425 independent, not part of a tree.
426 The TAB count don't need to be incremental
428 The nesting don't need
430 Quotes can be opened and closed
434 %%% Nesting: When not supported
435 Some targets (as sgml) don't support the
436 nesting of quotes. There is only one quote
438 In this case, no matter how much
439 TABs are used to define the quote
440 block, it always will be level 1.
442 %%% Syntax: Spaces after TAB
443 Spaces AFTER the TAB character are allowed.
444 But be careful, it can be confusing.
446 %%% Invalid: Spaces before TAB
447 Spaces BEFORE the TAB character
448 invalidate the mark. It's not quote.
450 %%% Invalid: Paragraphs inside
451 Paragraph breaks inside a quote aren't
454 This sample are two separated quoted
455 paragraphs, not a quote block with
456 two paragraphs inside.
458 %%% Closing: EOF closes the open block
459 The end of the file (EOF) closes the
460 currently open quote block.
464 See [Verbatim #verbatim], the same rules apply.
466 = Verbatim =[verbatim]
468 %INCLUDED(t2t) starts here: ../../../test/marks/verbatim.t2t
471 %%% Syntax: A single line
474 %%% Syntax: A single line with leading spaces
475 ``` Another verbatim line, with leading spaces.
477 %%% Syntax: Area (block)
479 A verbatim area delimited
483 %%% Syntax: Area (block) with trailing spaces
485 Trailing spaces and TABs after the area marks
486 are allowed, but not encouraged nor documented.
489 %%% Invalid: No space between mark and contents
490 ```Not a verbatim line, need one space after mark.
492 %%% Invalid: Leading spaces on block marks
495 The marks must be at the line beginning,
499 %%% Closing: EOF closes the open block
501 The end of the file (EOF) closes
502 the currently open verbatim area.
505 = Definition List =[deflist]
507 See [List #list], the same rules apply.
509 = Numbered List =[numlist]
511 See [List #list], the same rules apply.
515 %INCLUDED(t2t) starts here: ../../../test/marks/list.t2t
518 %%% Items: Prefixed by hyphen
519 - Use the hyphen to prefix list items.
520 - There must be one space after the hyphen.
521 - The list is closed by two consecutive blank lines.
524 %%% Items: Free leading spacing (indentation)
525 - The list can be indented on the source document.
526 - You can use any number of spaces.
527 - The result will be the same.
530 %%% Items: Vertical spacing between items
531 - Let one blank line between the list items.
533 - It will be maintained on the conversion.
535 - Some targets don't support this behavior.
537 - This one was separated by a line with blanks.
538 You can also put a blank line inside
540 the item contents and it will be preserved.
543 %%% Items: Exactly ONE space after the hyphen
544 -This is not a list (no space)
546 - This is not a list (more than one space)
548 - This is not a list (a TAB instead the space)
551 %%% Items: Catchy cases
557 %%% Nesting: Creating sublists
558 - This is the "mother" list first item.
559 - Here is the second, but inside this item,
560 - there is a sublist, with its own items.
561 - Note that the items of the same sublist
562 - must have the same indentation.
563 - And this can go on, opening sublists.
564 - Just add leading spaces before the
565 - hyphen and sublists will be opened.
566 - The two blank lines closes them all.
569 %%% Nesting: Free leading spacing (indentation)
570 - When nesting lists, the additional spaces are free.
571 - You can add just one,
573 - What matters is to put more than the previous.
574 - But remember that the other items of the same list
575 - must use the same indentation.
578 %%% Nesting: Maximum depth
579 - There is not a depth limit,
580 - you can go deeper and deeper.
581 - But some targets may have restrictions.
582 - The LaTeX maximum is here, 4 levels.
583 - This one and the following sublists
584 - are moved up to the level 4
585 - when converting to LaTeX.
586 - On the other targets,
588 - to have a very deep list.
591 %%% Nesting: Reverse doesn't work
592 - Reverse nesting doesn't work.
593 - Because a sublist *must* have a mother list.
594 - It's the list concept, not a txt2tags limitation.
595 - All this sublists will be bumped to mother lists.
596 - At level 1, like this one.
599 %%% Nesting: Going deeper and back
601 %% When nesting back to an upper level, the previous sublist
602 %% is automatically closed.
607 - Level 3 -- (closed Level 4)
608 - Level 2 -- (closed Level 3)
609 - Level 1 -- (closed Level 2)
612 %% More than one list can be closed when nesting back.
617 - Level 1 -- (closed Level 4, Level 3 and Level 2)
620 %%% Nesting: Vertical spacing between lists
623 - Level 2 -- blank BEFORE and AFTER (in)
626 % comment lines are NOT considered blank lines
628 % comment lines are NOT considered blank lines
631 - Level 2 -- blank BEFORE and AFTER (out)
635 - Level 2 -- blank BEFORE (spaces) and AFTER (TAB)
640 %%% Nesting: Messing up
641 %% Be careful when going back on the nesting,
642 %% it must be on a valid level! If not, it will
643 %% be bumped up to the previous valid level.
656 %%% Closing: Two (not so) empty lines
657 - This list is closed by a line with spaces and other with TABs
660 - This list is NOT closed by two comment lines
661 % comment lines are NOT considered blank lines
662 % comment lines are NOT considered blank lines
663 - This list is closed by a line with spaces and TAB,
664 - then a comment line, then an empty line.
666 % comment lines are NOT considered blank lines
668 %%% Closing: Empty item closes current (sub)list
670 %% The two blank lines closes ALL the lists.
671 %% To close just the current, use an empty item.
681 %% The empty item can have trailing blanks.
682 - Empty item with trailing spaces.
685 - Empty item with trailing TAB.
688 %%% Closing: EOF closes the lists
689 - If the end of the file (EOF) is hit,
690 - all the currently opened list are closed,
691 - just like when using the two blank lines.
696 %INCLUDED(t2t) starts here: ../../../test/marks/table.t2t
699 %%% Syntax: Lines starting with a pipe |
702 %%% Syntax: Extra pipes separate cells
703 | Cell 1 | Cell 2 | Cell 3
705 %%% Syntax: With a trailing pipe, make border
706 | Cell 1 | Cell 2 | Cell 3 |
708 %%% Syntax: Table lines starting with double pipe are heading
709 || Cell 1 | Cell 2 | Cell 3 |
711 %%% Align: Spaces before the leading pipe centralize the table
712 | Cell 1 | Cell 2 | Cell 3 |
714 %%% Align: Spaces inside the cell denote its alignment
715 || Heading | Heading | Heading |
716 % comments don't close an opened table
721 %%% Span: Column span is defined by extra pipes at cell closing
728 %%% Test: Empty cells are placed as expected
734 %%% Test: Lines with different number of cells
739 | 1 | 2 | 3 | 4 | 5 |
741 %%% Test: Empty cells + Span + Messy cell number = Fun!
747 | 20% | 40% | 60% | 80% | 100% |
751 | / / / / / / / / / |||||
756 | 01 | 02 | | | 05 | | 07 | |
757 | | | 11 | | 13 | | | 16 |
758 | 17 | | 19 | 20 | | | 23 | |
759 | 25 | 26 | | | 29 | 30 | | 32 |
760 | | | 35 | | 37 | | 39 | 40 |
762 %%% Test: Lots of cells at the same line
763 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
765 %%% Test: Empty lines
770 %%% Invalid: There must be at least one space around the pipe
771 |this|is|not|a|table|
773 |this| is| not| a| table|
775 |this |is |not |a |table |
777 %%% Invalid: You must use spaces, not TABs
778 | this | is | not | a | table |
780 ------------------------------------------------------------