PmWiki
|
| November 06, 2025, at 11:42 PM | Cookbook / MarkupTricks |
|
MarkupTricksSummary: Markup tricks
Version:
Prerequisites: Should work on any v 2.0 PmWiki
Status:
Maintainer:
Categories: MarkupOnly
Discussion: MarkupTricks-Talk
This page provides "markup tricks". Some workarounds to get to certain display results using existing markup. Do not confuse this page with MarkupExtensions, which adds new markup to PmWiki. Commenting out long blocks on a pageAlso known as: multiline comments If you want to put many lines of comments on a page that are only visible in edit view and that can include directives that you don't want processed, use the "if false" trick:
Using a new wiki markup {# ... #}Here is another way to comment out long blocks on a page which is shorter than (:if false:) ... (:ifend:). You can add new wiki markup by adding this code to your local/farmconfig.php or local/config.php:
Markup('{#','>[=','/\\{#(.*?)#\\}/s','');
Then, in the page, you write '''Hello {# This text
will be removed. It
could be multiline too.#} World'''
Which displays "Hello World". If you wish to add a toolbar button for the markup in your edit form, copy this picture $GUIButtons['wikicomment'] = array(360, '{#', '#}', '$[Comment out]',
'$GUIButtonDirUrlFmt/wikicomment.png"$[Comment out blocks]"');
Comment markup
Note that text "hidden" with this markup actually appears in the HTML page and in the page source. Some browsers will display it, search engines will see it and will show it in search results, and a reader can retrieve it by disabling page styles (CSS) or by viewing the page source. Spaceless block preformatHow can I do spaceless block preformat - that is, preformat multiple lines without prefixing each line with a single space? For instance, I want to display a code block in the wiki. The answer is our old friend,
In newer releases (~beta52) this is a good markup for code
If you are marking up a lot of code samples, you should check out SourceBlock. Preformatted text
Indenting blocks of text with line breaksBlocks of text to which
Displaying directivesI tried to post a note to my authors saying: If you enter 3 tildes (~~~) in a row, PmWiki will automatically insert your name. My markup was: ... 3 tildes [=(~~~)=] in a row ... which renders exactly the way I want in preview, but renders when saved as: ... 3 tildes (NeilHerber) in a row ... The problem is that the 3 tildes are a "replace on save" markup -- the tildes are replaced with the author's name at the time the page is saved. For a variety of reasons, it's not a trivial matter to preserve them when they appear inside of [=...=]. The workarounds are anything that causes the three tildes to not directly appear together, such as: [=~~=]~
~~~
This trick can be generalized to display any markup that you don't want rendered. The rule of thumb is to break up the markup with the [=...=] construct. WARNING: Reading the markup on this page in edit mode makes my head hurt! Insert spacing within a text lineTo insert additional spacing in a textline you can use space characters from the Special Characters List like       .
Spaces in file descriptors and URLsFor spaces in URLS simply enclose the URL in Link markup
For spaces in attachments (other than images)
For spaces in Images there is no really good solution. It is to be hoped that an enhancement[1] will be added to a future version of PmWiki to solve this issue. The following kludge can be used
Parentheses in URLsPmWiki parses out parentheses, ( and ), from links and URLs. To use in a URL replace ( with NotesSee Also
Contributors
CommentsSee discussion at MarkupTricks-Talk |
| Modified: December 23, 2021, at 06:48 AM | RecentChanges | AllRecentChanges |