//i""         => //i&q;&q;          ;; Reparse after first //
//i//""       => <em>i</em>&q;&q;   ;; // before "" shouldn't be included in Text
h//i//f       => h<em>i</em>f
//""i""       => //i
""~""""       => &q;&q;             ;; tests proper sorting of $positions (see the comment on ksort() in Tokenize)
a---""b""     => a&b;b
a---""b""""c""  => a&b;bc
==a==  => <h1>\na\n</h1>            ;; there was a bug in generating anchor name which caused infinite loops on too short headers.
=======6-th level=======  => <h6>\n6<sup>th</sup> level\n</h6>  ;; there was a bug that prevented 6th-level heading from recognizing.

{{a b}}         => <em class="format-error">Markup or action A doesn't exist.</em>  ;; block action.
{{a}} or {{b}}  => <em class="format-error">Markup or action A doesn't exist.</em> or <em class="format-error">Markup or action B doesn't exist.</em>   ;; 2 inline action with text " or " in between.
{{a}} b}}       => <em class="format-error">Markup or action A doesn't exist.</em> b}}   ;; inline action + text "b}}"
{{a\nb}}        => {{a&b;\nb}}

{{dbgecho k=v, 1=2, flg}} => <em>k=v, 1=2, flg=T</em>
{{dbgecho k=~}}}}         => <em>k=}}</em>
{{dbgecho k=~}}, flg}}    => <em>k=}}, flg=T</em>
{{dbgecho flg, k=~}}}}    => <em>flg=T, k=}}</em>
{{dbgecho ~}}=xyz}}       => <em>}}=xyz</em>
{{dbgecho ~}}}}           => <em>}}=T</em>
{{dbgecho ~~}}            => <em>~=T</em>
{{dbgecho ~~}}}}          => <em>~=T</em>}}
{{dbgecho ~~~~}}          => <em>~~=T</em>
{{dbgecho ~~~~}}}}        => <em>~~=T</em>}}
{{dbgecho ~~~~~~}}        => <em>~~~=T</em>
{{dbgecho ~~~~~~}}}}      => <em>~~~=T</em>}}
{{dbgecho ~~~}}           => {{dbgecho ~}}
{{dbgecho ~~~}}}}         => <em>~}}=T</em>
{{dbgecho ~~~~~}}         => {{dbgecho ~~}}
{{dbgecho ~~~~~}}}}       => <em>~~}}=T</em>
{{dbgecho ~~~~~~~}}       => {{dbgecho ~~~}}
{{dbgecho ~~~~~~~}}}}     => <em>~~~}}=T</em>
{{dbgecho ~}}             => {{dbgecho }}                   ;; ~ escaped }} thus it was removed.
{{dbgecho ~ }}            => <em>~=T</em>

h {{dbgecho k=v, 1=2, flg}} => h <em>k=v, 1=2, flg=T</em>   ;; the same tests as above but for inline action.
h {{dbgecho k=~}}}}         => h <em>k=}}</em>
h {{dbgecho k=~}}, flg}}    => h <em>k=}}, flg=T</em>
h {{dbgecho flg, k=~}}}}    => h <em>flg=T, k=}}</em>
h {{dbgecho ~}}=xyz}}       => h <em>}}=xyz</em>
h {{dbgecho ~}}}}           => h <em>}}=T</em>
h {{dbgecho ~~}}            => h <em>~=T</em>
h {{dbgecho ~~}}}}          => h <em>~=T</em>}}
h {{dbgecho ~~~~}}          => h <em>~~=T</em>
h {{dbgecho ~~~~}}}}        => h <em>~~=T</em>}}
h {{dbgecho ~~~~~~}}        => h <em>~~~=T</em>
h {{dbgecho ~~~~~~}}}}      => h <em>~~~=T</em>}}
h {{dbgecho ~~~}}           => h {{dbgecho ~}}
h {{dbgecho ~~~}}}}         => h <em>~}}=T</em>
h {{dbgecho ~~~~~}}         => h {{dbgecho ~~}}
h {{dbgecho ~~~~~}}}}       => h <em>~~}}=T</em>
h {{dbgecho ~~~~~~~}}       => h {{dbgecho ~~~}}
h {{dbgecho ~~~~~~~}}}}     => h <em>~~~}}=T</em>
h {{dbgecho ~}}             => h {{dbgecho }}
h {{dbgecho ~ }}            => h <em>~=T</em>

~~~~~a        => ~~~a
//h i~// f//  => <em>h i// f</em>   ;; tilde removed; middle // skipped
//h ~i// f//  => <em>h ~i</em> f//
//i ~~//      => <em>i ~</em>       ;; // shouldn't be escaped because ~ escapes itself
??\ncomment\n??   => ??&b;\ncomment&b;\n??    ;; multiline comments must only work in dubiousAsComments mode (which's on by default but off for tests).

""--s--"" ""--s--""   => --s-- --s--  ;; all "" should be removed; tests if offsets don't shift anywhere.
**a** "" **a**        => <strong>a</strong> &q;&q; <strong>a</strong>
**a** "" **a** ""     => <strong>a</strong>  **a**
""==h==""             => ==h==
//i~//        => //i//              ;; Reparse; first // shouldn't be lost.
t""           => t&q;&q;  ;; "" would be removed by Para as multiline esc. but it's last line so it's kept.
**""--""**    => <strong>—</strong>
this##type##mono => this<kbd>type</kbd>mono

%%~**%%         => <kbd>~**</kbd>
%%**%%          => <kbd>**</kbd>
c%%(f)a         => c%%(f)a
%%a             => %%a
%%"&quot;'&ent;%%   => <kbd>"&amp;quot;'&amp;ent;</kbd>
1%%2%%3%%4      => 1<kbd>2</kbd>3%%4
1%%2~%%3~%%4    => 1%%2%%3%%4
1%%2~%%3%%4     => 1<kbd>2%%3</kbd>4
1%%2~~%%3%%4    => 1<kbd>2~</kbd>3%%4
1%%2~~~%%3%%4   => 1<kbd>2~%%3</kbd>4
1%%2~~~~%%3%%4  => 1<kbd>2~~</kbd>3%%4
1%%2~~~~~%%3%%4 => 1<kbd>2~~%%3</kbd>4

%%(wacko)a~%%(pre)~~~%%~%%b%%  => a<kbd>%%</kbd>b        ;; there are 3 tildes, not 2 as one'd have thought because ~ is matched 2 times: global context converts ~~~ -> ~~, then %%(wacko) converts ~~ -> ~ (tilde that escapes itself).
%%(wacko)a~%%(pre)~~~~%%~%%b%% => a%%(pre)~%%b%%  ;; 4 tildes doesn't work because global context finds %% following them unescaped.
%%(color red)a~%%(color blue; inline_pre)~~~%%~%%b%%  => <span style="color: red" class="color">a<span style="color: blue" class="color"><kbd>%%</kbd></span>b</span>

**""**""**    => <strong>**</strong>  ;; mind-crushing.
((l)) **""**""**    => <a href="l">l</a> <strong>**</strong>
((a b?))      => <a href="a">b?</a>  ;; test glitch caused by PCRE matching ?) but not matching )) since its first ")" was already matched by ?), which was ignored.
There's a new walker (have you ((http://i-forge.net heard that?))) with 4 mln pics.   => There's a new walker (have you <a href="http://i-forge.net" target="_blank" class="external">heard that?</a>) with 4 mln pics.
((x==%%y%% | %%))%%))   => <a href="x" title="x"><kbd>y</kbd> | <kbd>))</kbd></a>
h ((url h ~%% f)) f     => h <a href="url">h %% f</a> f
h ((url h==~%% f)) f    => h <a href="url h">%% f</a> f

setting fetchRemoteTitles 1
((http://www.google.com)) => <a href="http://www.google.com" target="_blank" class="external">Google</a>
setting fetchRemoteTitles -
((http://www.google.com)) => <a href="http://www.google.com" target="_blank" class="external">[www.google.com]</a>

setting rootURL /uw/
((/root))       => <a href="/uw/root">root</a>  ;; root links must point to site's root instead of domain's root
setting rootURL -

setting rootURL /root/
setting baseURL base
((../a))        => <a href="/root/base/../a">a</a>
((/ab))         => <a href="/root/ab">ab</a>
((aa/..))       => <a href="/root/base/aa/..">..</a>
((.htaccess))   => <a href="/root/base/.htaccess">.htaccess</a>
((/.htaccess))  => <a href="/root/.htaccess">.htaccess</a>
((../.htaccess))=> <a href="/root/base/../.htaccess">.htaccess</a>
((..))          => <a href="/root/base/..">..</a>
((/))           => <a href="/root/">/</a>
((./..))        => <a href="/root/base/./..">..</a>
setting baseURL -
setting rootURL -

setting baseURL base/
setting pageForSelfAnchorLinks page
((rel))         => <a href="base/rel">rel</a>
((/abs))        => <a href="abs">abs</a>
((http://ext))  => <a href="http://ext" target="_blank" class="external">[ext]</a>
((rel#anch))    => <a href="base/rel#anch">anch</a>
((rel/#anch))   => <a href="base/rel/#anch">anch</a>
((/abs#anch))   => <a href="abs#anch">anch</a>
((/abs/#anch))  => <a href="abs/#anch">anch</a>
((trailAnchor#))  => <a href="base/trailAnchor">trailAnchor</a>   ;; trailing anchors must be removed.

((#self anch))  => <a href="page#self">anch</a>
((other#page anch))  => <a href="base/other#page">anch</a>
setting pageForSelfAnchorLinks -
((#self anch))  => <a href="#self">anch</a>
((other#page anch))  => <a href="base/other#page">anch</a>
setting baseURL -
((other#page anch))  => <a href="other#page">anch</a>

setting linkExt .html
((#Anchor link))            => <a href="#anchor">link</a>     ;; anchors must be lower-cased.
((Page))                    => <a href="Page.html">Page</a>   ;; pages should have linkExt appended
((Page#Anchor))             => <a href="Page.html#anchor">Anchor</a>   ;; linkExt + lower case of anchors.
((http://external))         => <a href="http://external" target="_blank" class="external">[external]</a>   ;; external links should be kept intact.
((http://external#Anchor))  => <a href="http://external#Anchor" target="_blank" class="external">[external]</a>
((A\\b#Anc\\h))             => <a href="A/b.html#anc\\h">Anc\\h</a>  ;; testing translations of Windows-style paths into Unix-style.
((http://ext/a\\b))         => <a href="http://ext/a\\b" target="_blank" class="external">[ext]</a>
((dir/))                    => <a href="dir/">dir</a>    ;; linkExt shouldn't be appended to directories.
((dir\\))                   => <a href="dir/">dir</a>
((.))                       => <a href=".">.</a>
((..))                      => <a href="...html">..</a>   ;; .. is outside the root dir of pager so it's not a folder.
((.\\config))               => <a href="./config">config</a>  ;; it's a directory, no linkExt appended.
((notexisting))             => <a href="notexisting.html">notexisting</a>
((notexisting\\))           => <a href="notexisting/">notexisting</a>
setting linkExt -

setting baseURL abc/
((ext://me/path))     => <a href="ext://me/path" target="_blank" class="external">[ext://me]</a>
((local.html))        => <a href="abc/local.html">local.html</a>
setting baseURL -

h %%(wacko)//i//%%    => h <em>i</em>
h %%~%%kwack%%        => h <kbd>%%kwack</kbd>
h %%~%%kw~%%ck%%      => h <kbd>%%kw%%ck</kbd>
h %%~%%kwack~%%%%     => h <kbd>%%kwack%%</kbd>
h %%(0)text%%         => h <kbd>(0)text</kbd>
h %%(0z) text%%       => h <kbd>(0z) text</kbd>  ;; first char of style name must be a letter.

h %%~(wacko) esc%%       => h <kbd>(wacko) esc</kbd>
h %%~~(wacko) esc%%      => h <kbd>(wacko) esc</kbd>    ;; this...
h %%~~~(wacko) esc%%     => h <kbd>~(wacko) esc</kbd>
h %%~~~~(wacko) esc%%    => h <kbd>~(wacko) esc</kbd>   ;; ...and this are exceptions for now (~ is removed by Tokenizer and removed again in by %% itself when it seems an (escaped) style name following it.
h %%~~~~~(wacko) esc%%   => h <kbd>~~(wacko) esc</kbd>
h %%no ~"" tokens ""in""side%%  => h <kbd>no ~&q;&q; tokens &q;&q;in&q;&q;side</kbd>

%%\n%%(pre)\n ~%%\n%%     => <pre>%%(pre)\n %%</pre>   ;; note that we test multiline %% here.
%%\n%%(pre)\n ~~%%\n%%    => <pre>%%(pre)\n ~%%</pre>
%%\n%%(pre)\n ~~~%%\n%%   => <pre>%%(pre)\n ~~%%</pre>
%%\n%%(pre)\n ~~~~%%\n%%  => <pre>%%(pre)\n ~~~%%</pre>
%%\n%%(pre)\n ~~~~~%%\n%% => <pre>%%(pre)\n ~~~~%%</pre>
%%\nno ~"" tokens ""in""side\n%%  => <pre>no ~&q;&q; tokens &q;&q;in&q;&q;side</pre>

(st) par      => (st) par               ;; paragraph must have "(styleName)" prefixed with a dot.
.(s!) par     => .(s!) par              ;; valid chars in style name are [a-zA-Z0-9_]
.(ст_иль)p    => <p class="ст_иль">\np\n</p>  ;; style name can only include non-Latin chars.
.(не!стиль)p  => .(не!стиль)p                 ;; style name can only include non-Latin chars but only word chars.
.(not-a)style => .(not-a)style                ;; only underscores are allowed in style names - not dashes.
.(a b a)paragraph => <p class="a b">\nparagraph\n</p>   ;; duplicate class names should be removed.
.(x)          => <p class="x">\n</p>
.(x)y         => <p class="x">\ny\n</p>
.(x)\ny       => <p class="x">\ny\n</p>
.(x)\n\ny     => <p class="x">\n</p>\n<p>\ny\n</p>

%%(s!)code%%  => <kbd>(s!)code</kbd>
!!(nostyle)!! => <span class="highlight nostyle"></span>
!!(st)body!!  => <span class="highlight st">body</span>
!!(0) text!!  => <span class="highlight default">(0) text</span>
!!(0z)text!!  => <span class="highlight default">(0z)text</span>
!!(w00t)text!!  => <span class="highlight w00t">text</span>
!!(w_00)text!!  => <span class="highlight w_00">text</span>

!!(nest1)!!(nest2)content!!!!     => <span class="highlight nest1"><span class="highlight nest2">content</span></span>
!!~(come)!!    	                  => <span class="highlight default">(come)</span>
(I)!!(said)!!(come)!!(on)!!(you)  => (I)!!(said)!!(come)!!(on)!!(you)   ;; no !! worked because if !! is followed by ( it's always treated as an opening tag.
(I)!!(said)!!(come)!!(on)!!you    => (I)!!(said)!!(come)<span class="highlight on"></span>you
(I)!!(said)!!(come)!!on!!you      => (I)<span class="highlight said"><span class="highlight come"></span>on</span>you
(I)!!~(said)!!(come)!!on!!you     => (I)<span class="highlight default">(said)<span class="highlight come"></span>on</span>you
(I)!!(said)!!~(come)!!on!!you     => (I)<span class="highlight said"></span>~(come)<span class="highlight default">on</span>you     ;; tilde was put between !! and ( (of "(come)") so !! didn't consider it was an opening tag and closed itself.
h !!(wrap)!!(nest)1!! middle !!(nest)2!!!! f => h <span class="highlight wrap"><span class="highlight nest">1</span> middle <span class="highlight nest">2</span></span> f    ;; if !! is followed by "(" it's considered a start tag no matter if the style following is valid or not.

!!~(st) text!!    => <span class="highlight default">(st) text</span>
!!~(st?) text!!   => <span class="highlight default">~(st?) text</span>
!!(st)!!       => <span class="highlight st"></span>
!!~(st?)!!      => <span class="highlight default">~(st?)</span>
!!~~(st?)!!     => <span class="highlight default">~(st?)</span>
!!~~~(st?)!!    => <span class="highlight default">~~(st?)</span>
!!~~~~(st?)!!   => <span class="highlight default">~~(st?)</span>
!!~~~~~(st?)!!  => <span class="highlight default">~~~(st?)</span>

!!(x)y!!        => <span class="highlight x">y</span>
!!~(x)y!!       => <span class="highlight default">(x)y</span>
!!~~(x)y!!      => <span class="highlight default">~(x)y</span>
!!~~~(x)y!!     => <span class="highlight default">~~(x)y</span>
!!~~~~(x)y!!    => <span class="highlight default">~~(x)y</span>
!!~~~~~(x)y!!   => <span class="highlight default">~~~(x)y</span>

--- => <hr class="thin" />
      ~~~~~~ => <hr class="curvy" />
   ************** => <hr class="dotted" />
  ========= => <hr class="thick" />
-=-=-= => -=-=-=
===== ======== => ===== ========
~~~~~~a~~~~~ => ~~~a~~~

**bold** //ita ++small++// __under ^^sup?^^__ => <strong>bold</strong> <em>ita <small>small</small></em> <ins>under <sup>sup?</sup></ins>
(?Wiki Wiki-wiki writing?) => <abbr title="Wiki-wiki writing">Wiki</abbr>
(?SHWACK == SuperHidden Wicious Alpha-Connected Kommutee?) => <abbr title="SuperHidden Wicious Alpha-Connected Kommutee">SHWACK</abbr>
A (?A aaa?) A => A <abbr title="aaa">A</abbr> A   ;; short terms (default < 2) are not expanded.
AA (?AA aa?) AA => AA <abbr title="aa">AA</abbr> <abbr title="aa">AA</abbr>
(?a~==b==c==d?) => <abbr title="c==d">a==b</abbr>   ;; 3rd == mustn't be dropped albeit 2nd was recognized as separator.

(?Shh?) SHHH! => <abbr title="Shh">Shh</abbr> SHHH!
(?Shh?) Shh! => <abbr title="Shh">Shh</abbr> <abbr title="Shh">Shh</abbr>!
(?Shh wacko?) Shhwacko? => <abbr title="wacko">Shh</abbr> Shhwacko?
(?Shh wacko?) Shh wacko? => <abbr title="wacko">Shh</abbr> <abbr title="wacko">Shh</abbr> wacko?

(?def==опр?)          => <abbr title="опр">def</abbr>
(?def~==опр?)         => <abbr title="def~==опр">def~==опр</abbr>
(?def~==не_опр опр?)  => <abbr title="опр">def~==не_опр</abbr>
(?def опр опр?)       => <abbr title="опр опр">def</abbr>
(?def опр == опр?)    => <abbr title="опр">def опр</abbr>
(?def ~~== опр?)      => <abbr title="опр">def ~</abbr>
(?def~~~==не_опр?)    => <abbr title="def~~==не_опр">def~~==не_опр</abbr>  ;; ~~ instead of ~~~ since 1 tilde ascapes the following which is output and 1 doesn't escape anyting so it's also output

(?def?)     => <abbr title="def">def</abbr>
(?def~?)    => (?def?)
(?def~~?)   => <abbr title="def~">def~</abbr>
(?eh ??)    => (?eh ??)    ;; title/desc can have markup so normal nesting rules apply - and !! is a token which isn't closed here.
(?eh ?!?)   => <abbr title="?!">eh</abbr>
(?eh ???highlight??)    => (?eh <var class="dubious default">?highlight</var>)
(?eh ???highlight???)   => <abbr title="?highlight">eh</abbr>

(?term second?) (?second desc?) term  => <abbr title="second">term</abbr> <abbr title="desc">second</abbr> <abbr title="second">term</abbr>  ;; terms containing name of another term shouldn't be replaced and break HTML.
(?term 1st?) (?term 2nd term?) term  => <abbr title="1st">term</abbr> <abbr title="2nd term">term</abbr> <abbr title="2nd term">term</abbr>
Table of Contents ((?TOC Table of Contents?)) => Table of Contents (<abbr title="Table of Contents">TOC</abbr>)

(?two  spc?) => <abbr title="spc">two</abbr>
((looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong==//i)) => <a href="looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong">//i</a> ;; see Uwacko_Tokenizer::$maxFirstTokenPartLen.  ;; testing $firstTokenPartLookAheadLength.
((abc==//i)) => ((abc==//i))
((no **fmt** == so --w/e--?)) => <a href="no **fmt**">so <del>w/e</del>?</a>
((ext://li nk==title)) => <a href="ext://li nk" target="_blank" class="external">title</a>
[[ext://li nk==title]] => <a href="ext://li nk" target="_blank" class="square-brackets external">title</a>
((link)) => <a href="link">link</a>

((sub+st))new     => <a href="subst">subnew</a>
((add+))on        => <a href="add">addon</a>
((add+))!nothing  => <a href="add+">add+</a>!nothing   ;; if both link end and new ending are empty the link is treated normally.
((cut+off))          => <a href="cutoff">cut</a>
((cut+off))!this     => <a href="cutoff">cut</a>!this

о ((стандарт+ы))ах   => о <a href="стандарты">стандартах</a>
о ((стандарт+ы))ах!  => о <a href="стандарты">стандартах</a>!
о ((стандарт+ы))!ах  => о <a href="стандарты">стандарт</a>!ах
о ((стандарт+ы!))ах  => о <a href="стандарт+ы!">стандарт+ы!</a>ах

фф ((сс+ппп))яяя пп  => фф <a href="ссппп">ссяяя</a> пп    ;; there was a bug that left out 3rd char at the end (if it was non-Latin).
фф ((сс+пп))яяя пп   => фф <a href="сспп">ссяяя</a> пп
фф ((сс+п))яяя пп    => фф <a href="ссп">ссяяя</a> пп
фф ((сс+п))яя пп     => фф <a href="ссп">ссяя</a> пп
фф ((сс+п))я пп      => фф <a href="ссп">сся</a> пп
фф ((сс+пп))я пп     => фф <a href="сспп">сся</a> пп
фф ((сс+пп))яя пп    => фф <a href="сспп">ссяя</a> пп
фф ((сс+ппп))я пп    => фф <a href="ссппп">сся</a> пп
фф ((сс+ппп))яя пп   => фф <a href="ссппп">ссяя</a> пп

hh ((li+nnn))kkk ff  => hh <a href="linnn">likkk</a> ff
hh ((li+nn))kkk ff   => hh <a href="linn">likkk</a> ff
hh ((li+n))kkk ff    => hh <a href="lin">likkk</a> ff
hh ((li+n))kk ff     => hh <a href="lin">likk</a> ff
hh ((li+n))k ff      => hh <a href="lin">lik</a> ff
hh ((li+nn))k ff     => hh <a href="linn">lik</a> ff
hh ((li+nn))kk ff    => hh <a href="linn">likk</a> ff
hh ((li+nnn))k ff    => hh <a href="linnn">lik</a> ff
hh ((li+nnn))kk ff   => hh <a href="linnn">likk</a> ff

((this+fine))  => <a href="thisfine">this</a>
((too+longg))  => <a href="too+longg">too+longg</a>
((to+o))longg  => <a href="to+o">to+o</a>longg
фф ((сс+пппп))яяяяя пп  => фф <a href="сс+пппп">сс+пппп</a>яяяяя пп
фф ((сс+ппппп))яяя пп  => фф <a href="сс+ппппп">сс+ппппп</a>яяя пп
фф ((сс+пппп))яяя пп   => фф <a href="сспппп">ссяяя</a> пп
фф ((сс+ппп))яяяя пп   => фф <a href="ссппп">ссяяяя</a> пп

((no li+nk))    => <a href="no">li+nk</a>
((no==li+nk))   => <a href="no">li+nk</a>
((no no==li li+nk))   => <a href="no no">li li+nk</a>
((no~+link))    => <a href="no~+link">no~+link</a>
((no://li+nk))  => <a href="no://li+nk" target="_blank" class="external">[no://li+nk]</a>

//0//   => <em>0</em>                 ;; (bool) 0 === false  while  not being an ''.
0       => 0                              ;; paragraph skipts empty lines so we test what it considers empty.
((li nk==))   => <a href="li nk">li nk</a>
((li ))       => <a href="li">li</a>
((li====ca))  => <a href="li">==ca</a>
((li~====ca)) => <a href="li==">ca</a>
((li ~====))  => <a href="li ==">li ==</a>
((li~====))   => <a href="li==">li==</a>
((li~==== ))  => <a href="li==">li==</a>

hh---ff       => hh&b;ff
hh~---ff      => hh---ff
hh~~---ff     => hh~&b;ff
hh~~~---ff    => hh~---ff
hh~~~~---ff   => hh~~&b;ff
hh~~~~~---ff  => hh~~---ff
hh------------ff  => hh&b;ff
h~    => h~   ;; there was a bug that removed ~ and appended ---
h~~   => h~
h~~~  => h~~

hh%%%%ff  => hhff
%%**no tokens inside%%    => <kbd>**no tokens inside</kbd>
%%no **tokens** inside%%  => <kbd>no **tokens** inside</kbd>

h (??)    => h (??)       ;; testing that empty tokens are skipped
h (())    => h (())
h [[]]    => h [[]]
{{}}      => {{}}         ;; empty block action
h {{}}    => h {{}}       ;; empty inline action
h ****    => h            ;; empty simple formatting tokens are fine, are simply removed.
h ^^^^    => h
1 !!!!    => 1
1 ????    => 1
h %%%%    => h


Multiline tests

(())\n
para
  =>
(())
</p>
<p>
para
  ;; there was a bug that caused PCRE to match "))\n" as block footnote's ending token while TextBlock's token was "\n\n" without look-ahead, thus making PCRE to skipp it.

=== %%(php) Legend()%% ===
  =>
<h2>
<code class="format format-php"><span style="color: #000000"><span style="color: #0000BB">Legend</span><span style="color: #007700">()</span></span></code>
</h2>
  ;; there was a bug that caused PHP highlighter to modify $this->raw upon each rendering so when it was rendered twice (first as a formatter, second upon Anchorizing of the header) it was output as "<? Legend()" instead of "Legend()".

{{dbgecho: значение% = "%%(php) array('value', ...)%%"}}
  =>
<em>значение%=%%(php) array('value', ...)%%</em>
  ;; due to a bug in format args parsing leading space of arg ("= ...") prevented quotes from recognition so the above would actually be 2 args: first ending on "value'" and second starting with " ...)%%".

{{dbgecho: "%%(php) array('value', ...)%%"}}
  =>
<em>%%(php) array('value', ...)%%=T</em>

{{dbgecho: "%%(php) array('value', ...)%%" = abc}}
  =>
<em>%%(php) array('value', ...)%%=abc</em>

==h
f==
  =>
==h&b;
f==
  ;; headings are not multiline

== h ===========
%%
c
%%
  =>
<p>
== h ===========
</p>
<pre>c</pre>
  ;; == should be skipped and thus %% must be matched; %% won't match
  if it'll be nested in == - that's what we test here.

setting headingMode extended

== lv1 ==
== lv2 ==
=== lv3 ===
====== lv6 ======
  =>
<h1>\nlv1\n</h1>
<h2>\nlv2\n</h2>
<h3>\nlv3\n</h3>
<h6>\nlv6\n</h6>

setting headingMode shifted

== lv2 ==
=== lv3 ==
====== lv6 ==
======= none ==
  =>
<h2>\nlv2\n</h2>
<h3>\nlv3\n</h3>
<h6>\nlv6\n</h6>
<p>
======= none ==
</p>

setting headingMode shifted-2

== lv2 ==
=== lv3 ==
====== lv6 ==
======= none ==
  =>
<h2>\nlv2\n</h2>
<h3>\nlv3\n</h3>
<h6>\nlv6\n</h6>
<p>
======= none ==
</p>
  ;; the same as just 'shifted'

setting headingMode shifted-4

== lv4 ==
=== lv5 ==
==== lv6 ==
===== also h6 (max possible for HTML) ==
======= none ==
  =>
<h4>\nlv4\n</h4>
<h5>\nlv5\n</h5>
<h6>\nlv6\n</h6>
<h6>\nalso h6 (max possible for HTML)\n</h6>
<p>
======= none ==
</p>

setting headingMode -

%%
c
%%(pre)
  =>
%%&b;
c&b;
%%(pre)
  ;; %%(fmt_name) can only be a starting token thus %% here will be skipped.

<[
a
]>
  =>
<blockquote class="block">
<p>
a
</p>
</blockquote>

""""
%%
123456789
%%
  =>
<p>
</p>
<pre>123456789</pre>
  ;; testing offsets shifting of "" - text inside %% must be intact.

%%
<[
%%
=>
<pre>&lt;[</pre>
  ;; %% can't contain any elements

<[
<[Q]>
  =>
<p>
&lt;[
</p>
<blockquote class="block">
<p>
Q
</p>
</blockquote>

    Inde-
  ntat-
  ion.
=>
<p class="indent-1 default">
  Inde-&b;
ntat-&b;
ion.
</p>
  ;; level = floor( (4 + 2 + 2) / 2 / 3 ) = 1

%%
a
%%
\n
==a==
  =>
<pre>a</pre>
<h1>
a
</h1>

**b** "" ^^su^^
//i// ""
  =>
<strong>b</strong> &q;&q; <sup>su</sup>&b;
<em>i</em> &q;&q;

""
==h==
""
  =>
&q;&q;
</p>
<h1>
h
</h1>
<p>
&q;&q;

---
f
  =>
<hr class="thin" />
<p>
f
</p>

a
b---c
  =>
a&b;
b&b;c
  ;; a bug caused contents after --- be repeated from the first line ("a", "b", "a", ...).

a---b---c---d---
---2---
  =>
a&b;b&b;c&b;d&b;&b;
&b;2&b;

%%(pre)
~**no tags** including ~~ tilde ""are parsed"" //inside format//
%%
  =>
<pre>~**no tags** including ~~ tilde &q;&q;are parsed&q;&q; //inside format//</pre>

  %%(pre)
  chrono crusoss
  %%
=>
<pre>  chrono crusoss</pre>

%%
z
%%
\n\na
\n\nb
  =>
<pre>z</pre>
<p>
a
</p>
<p>
b
</p>
  ;; there was a bug that repeated the element preceding each paragraph.

  = a ~== b
=>
<dl>
<dt>
a
</dt>
<dd>
~== b
</dd>
</dl>
  ;; an uncertain parsing case when tilde must be removed as it escapes 2 sides' separator but at the same time there's no other separator so these are not 2 sides separated by == but rather separated by a space, thus "~" doesn't escape anything as is left in place. It's easily resolved by explicitly putting "==" between the sides, such as "  = a == == b".

??
  block comments
  are off
  by default
??
  =>
??&b;
  block comments&b;
  are off&b;
  by default&b;
??

setting dubiousAsComments true

??
  a
  **block**
  comment
??
  =>
<div class="comment">
<p class="indent-1 default">
a<br />
<strong>block</strong><br />
comment
</p>
</div>

setting dubiousAsComments -

%%(html)
<style>
.css { font-family: v; }
</style>
%%
  =>
<div class="wackowiki format format-html">
<!--notypo--><pre class="code"><span style="color: #000080;font-weight:bold;">&lt;style&gt;</span><!--notypo--><span style="color: blue;">
.css <span style="color: #800000; font-weight: bold;">{</span> <span style="color: red;">font-family</span><span style="color: #800000; font-weight: bold;">:</span> v; <span style="color: #800000; font-weight: bold;">}</span>
</span>&nbsp;<span style="color: blue;"></span><!--/notypo--><span style="color: #000080;font-weight:bold;">&lt;/style&gt;</span></pre><!--/notypo-->
</div>
  ;; besides testing for Wacko highlighter (html) it also tests how it calls another one from itself (css).

%%(include)
== h 1 ==
1
\n
2
\n
3
\n
4
\n
5
\n
6
\n
7
\n
8
\n
9
\n
0
\n
1
{{toc}}
===h 2==
%%
  =>
<h2>
h 1
</h2>
<p>
1
</p>
<p>
2
</p>
<p>
3
</p>
<p>
4
</p>
<p>
5
</p>
<p>
6
</p>
<p>
7
</p>
<p>
8
</p>
<p>
9
</p>
<p>
0
</p>
<p>
1
</p>
<fieldset class="toc">
<ol>
<li>
<span class="index">1.</span> <a href="#h_1">h 1</a><ol>
<li>
<span class="index">1.1.</span> <a href="#h_2">h 2</a>
</li>
</ol>
</li>
</ol>
</fieldset>
<h3>
h 2
</h3>
  ;; there was a bug with ksort() and tree positions - "10" sorts before "2" (lex order). See UWikiBaseElement->TreePosID().

##(one)
container
##
##(first second)
container
##
  =>
<div class="container one">
<p>
container
</p>
</div>
<div class="container first second">
<p>
container
</p>
</div>

.(one)
paragraph
\n
.(first second)
paragraph
\n
>>(first second)
paragraph<<
  =>
<p class="one">
paragraph
</p>
<p class="first second">
paragraph
</p>
<p style="text-align: center" class="first second">
paragraph
</p>

.(one)
paragraph
.(first second)
paragraph
>>(first second)
paragraph<<
  =>
<p class="one">
paragraph
</p>
<p class="first second">
paragraph
</p>
<p style="text-align: center" class="first second">
paragraph
</p>
  ;; unlike previous test there is no blank line before the middle paragraph's ".(first second)" style.

!!(first second)highlight!!
!!(one)highlight!!
  =>
<span class="highlight first second">highlight</span><br />
<span class="highlight one">highlight</span>

== Doc title ==
\n
##(style)
=== Legend ===
==== Subheading ====
Text.
##
\n
{{TOC}}
  =>
<h1>
Doc title
</h1>
<fieldset class="container style">
<legend>
Legend
</legend>
<h3>
Subheading
</h3>
<p>
Text.
</p>
</fieldset>
<fieldset class="toc">
<legend>
Doc title
</legend>
<ol>
<li>
<span class="index">1.</span> <a href="#legend">Legend</a><ol>
<li>
<span class="index">1.1.</span> <a href="#subheading">Subheading</a>
</li>
</ol>
</li>
</ol>
</fieldset>