Tests for a PmWiki syntax highlighter
This is to test Cookbook:PmSyntax (syntax highlighting only). Try the Toggle buttons!
Notes
Don't feel intimidated by the apparent complexity, in most real-world scenarios you'll have much fewer markups so close together (except probably in pagelist templates and forms which are edited rarely). In a usual situation you'll have the occasional markup stand out.
If this is bad, the same without highlighting is probably worse ;-)
and Toggle dark theme
! Page structure
(:toc:) (:notoc:)
!! Heading
!!! Subheading
!!!! Sub-subheading
----- horizontal rule
Q: Question
A: Answer
!! Basic markup
* List
* List
## Nested
## Item
Part of "Item"
## After
* Another kind of nested,
* aligned to "A" above
: Term : Definition
: Term2 : Def 2
: With [=:=] colon: Definition
Preformatted block with
'''leading''' spaces
-> Indented text
------< hanging text line
!! Inline markups
'''Strong''', ''emphasis'',
@@code@@, '-small-', '+big+'
[--smaller--], [++bigger++]
{+underlined+}, {-struck-}
'^superscript^', '_subscript_'
Join line \
with next.
Line breaks\\
More line breaks\\\\\
[=escaped text, not processed,
and can span multiple lines=]
[@ Another escaped text.
* ''Markup'' isn't processed.
@]
!!! Custom inline markups
Would need some configuration:
'~italic~' and '*bold*'
[^footnote^] {$ formula $}
!! Core meta directives
(:title Syntax highlighting for PmWiki markup:)
(:description Some text:)
(:keywords Documentation, edit, help, markup:)
(:Summary: Tests for a PmWiki syntax highlighter:)
(:linebreaks:) or (:nolinebreaks:), or even (:nl:)
(:nolinkwikiwords:) or (:nospacewikiwords:)
(:comment Message to the editors:)
%comment% Message to updaters %%
(:redirect PageName#anchor status=301 from=name quiet=1:)
!!! Conditionals
(:if3 expr auth admin || auth attr || auth edit :)
[[Logout -> {$Name}?action=logout]]
(:elseif3 [ ! auth read {*$FullName} && name Group.* ] :)
Conditional
(:elseif3 date 2021-12-28..:) A (:else3:) B (:if3end:)
!!! Skin sections
(:noleft:)(:noright:)(:noaction:)(:notitle:)(:noheader:)
(:nofooter:), (:nogroupheader:)(:nogroupfooter:)
!!! Page text variables
Property: Start of line text variable
:Another: Variable in definition list
(:MyVariable:Some value:) or (:EmptyValue::)
(:Multiline:Variable
can have line
breaks :)
Print out variables: {$FullName}, {*$Title}, {*$:Summary}
{{*$Name}$:Summary} {Group.OtherPage$Title}
In Pagelist templates: {=$Group}, {<$Group}, {>$Group}
In templates and included sections: {$$variable}
(:include {*$FullName}-Users#fromanchor#toanchor \
lines=12..34 self=0 basepage=abc variable=value :)
!! [[WikiStyles]]
%blue% some text%%
%apply=block color=red% Some text
%define=mystyle apply=p \
border="2px dotted green"%
>>frame bgcolor=yellow<<
Text
>><<
%newwin% [[Link]] %%
* item %list classname id=ul2%
* item %item comment%
## %ALPHA% A
## B
## C %value=6%
!!! Some PHP and CSS code
See [[WikiStyles#highlight]]
%hlt php% [@
# only geeks allowed
if(!isset($EnableGeek)) exit;
@]
%hlt css% [@
/* only ants can read */
body, body * {
font-size: 1px !important;
}@]
!! Blocks, advanced tables
(:div3 class=myblock:)
(:section id=mysection:)
text
(:sectionend:)
(:div3end:)
(:details open=open \
summary="Toggle section...":)
Some text
(:detailsend:)
(:table class=t1 border=1:)
(:cell colspan=2:) H
(:tableend:)
Actual snippet from a custom menu and Toggle dark theme
Contains conditionals, form elements with attributes and values,
wikistyles, page variables, page text variables, and custom
Markup Expressions nested in the form values.
(:if33 expr enabled EnableWorse && ! name SideBar,RecentChanges,GroupAttributes:)
* %item padding="1mm 4mm"% (:input default source={*$FullName}:) \
(:input checkbox id=m_chk label="Page maintainer":) \
%id=m_claim%claim%% %id=m_clear%clear%%\\
(:input text $:MaintainerName placeholder="Maintainer name" \
data-me="{(userdata $real_name)}" id=MaintainerName:)\\
(:input text $:MaintainerEmail placeholder="Maintainer email" \
size=14 data-me="{(userdata $email)}" id=MaintainerEmail:)\
(:input button setmainainer Save id=savemaintainer:)
* [[{*$FullName}#deletepage"Delete page and all history"|Delete page]] %item color=red%
(:if33end:)
(Looking at this I think it would have been wiser to write a custom directive, but this is an old website built gradually with small additions over the years. --Petko)
0: 00.00 00.00 config start
1: 00.01 00.01 config end
2: 00.22 00.21 MarkupToHTML begin
3: 00.22 00.21 MarkupToHTML begin
4: 00.23 00.22 MarkupToHTML end
5: 00.25 00.24 MarkupToHTML end
6: 00.26 00.24 MarkupToHTML begin
7: 00.27 00.25 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
8: 00.27 00.25 ReadApprovedUrls SiteAdmin.ApprovedUrls end
9: 00.28 00.26 MarkupToHTML end
10: 00.28 00.26 MarkupToHTML begin
11: 00.28 00.26 MarkupToHTML end
12: 00.28 00.27 now