Инструменты пользователя

Инструменты сайта


beget:dokuwiki:syntax

Синтаксис форматирования

Шпаргалка по синтаксису. Практически все выдрано из соответствующего контекста.

DokuWiki

Cloud Plugin

This is a very simple plugin that shows a cloud of the most frequently used words in your wiki:

~~CLOUD~~
~~CLOUD:number~~

Optionally you can specify the number of words to display. Default is 50. Allowed are numbers between 1 and 999. Each of the words is linked to the search result page for it. The words are styled in a way that more frequent words are bigger and have a darker link color.

You can exclude words from the word cloud by adding them each on its own line to inc/lang/[lang-code]/stopwords.txt or to conf/stopwords.txt. Remember that last line in file should be empty to work correctly.

This plugin can also make a «tag cloud» now! (tag plugin must be installed) The syntax is also simple:

~~TAGCLOUD~~
~~TAGCLOUD:number~~
~~TAGCLOUD:number>namespace1:subns11|.|namespace2~~

It also supports clouds for the most searched words in the wiki (searchstats plugin must be installed):

~~SEARCHCLOUD~~
~~SEARCHCLOUD:number~~

Since release 2017-08-05 the number of occurrences can also be output by adding the showCount option like this:

~~CLOUD[showCount]~~

Comment Syntax Plugin

1. 'C' style comments

'C' style comments start with /* and ends with */. The comment-start markup /* must be placed at the start of line, or after a white-space letter. Comments can also span multiple lines:

/* This is a comment */
/* This is 
a multi-line
comment */

The comment syntax mode has priority to list block mode. You may comment-out some list item without breaking the whole list structure.

  - item 1 /* A white space is necessary before comment-start markup */
/*- item 2    will be eliminated from this list without breaking it */
  - item 3 /* will be numbered as 2 in the list */ 
  1. item 1
  2. item 3

Note that 'C' style comments end at the first */ encountered. If you however wish that nested comments should be treated correctly, you can change the behavior through the configuration. In case the use_cstyle_nest option is enabled (default off), the whole part enclosed in outmost pair of /* and */ recognized as a comment:

/* There is an another comment /* in this comment */ (nested comment)*/

2. one-line comment

The «one-line» comment syntax will be available if the use_oneline_style option is enabled (default off).

  * non-ordered list item // comment 
  • non-ordered list item
  - item 1 // A white space is necessary before One-line comment markup
//- item 2    will be eliminated from this list without breaking it
  - item 3 // will be numbered as 2 in the list
  1. item 1
  2. item 3

:!: Adverse effect: The one-line comment syntax // may interfere with the markup for italics. The use of italic formatting markup //...// will be restricted so that it can not go over next line.

This text //in italics. 
is rendered as normal // due to broken double-slash pairs

This text is rendered as normal

3. Control Macro like Comments

There are so-called control macros syntax, such as ~~NOCACHE~~. It may be convenient if you put a white space between ~~ and NOCACHE~~, it becomes a comment without displaying in the page.

~~ This is a comment without affecting other macros in the page. ~~

CustomButtons Plugin

Multiline Codes

If you want to have a shortcut for a common used multiline template (eg. a table) you can use «\n» in the code field to denote the line change.

Example:

Label: 3x3 Table
Code: ^ header1  ^ header2  ^ header3  ^\n|  valueA1  |  valueA2  |  valueA3  |\n|  valueB1  |  valueB2  |  valueB3  |

Discussion Plugin

Comments-section

This is the main part of the plugin. By including the ~~DISCUSSION~~ instruction in your wiki page, a discussion section will be appended after the normal wiki page content. To turn it off again, use ~~DISCUSSION:off~~. If you want to show the existing discussion but don't want to allow new comments / replies, use ~~DISCUSSION:closed~~.

~~DISCUSSION~~
~~DISCUSSION:off~~
~~DISCUSSION:closed~~

A custom title can be appended after the separator |.

~~DISCUSSION|Custom Title String~~
~~DISCUSSION:closed|Custom Title String~~

After each comment in the discussion section there may be up to three buttons (depending on your rights):

  • Reply: To reply to a comment (vs. commenting on the wiki page content), click the Reply button. The comment entry form will then be placed accordingly.
  • Edit: Registered users can edit their comments; admins can edit all comments. To remove a comment, just edit it, clear the text and save the empty comment – like you would do with a wiki page.
  • Delete: Registered users and admin all comments.
    Attention: If there are replies to a comment, removing it will also remove all replies!
  • Hide / Show: Admins can deactivate and reactivate comments easily by this button. Hidden comments aren't shown to normal users and are displayed dimmed to admins. Registered users can only hide their own comments.

Of course, the whole DokuWiki syntax can be used in comments as well. But there are problems with headers and footnotes as they may produce conflicting IDs and thus invalid XHTML. I'm looking for a way to either allow only a subset of the wiki syntax or automatically create unique IDs.

Threads syntax

This displays a list of all pages of the given namespace with a discussion section. The list is sorted by the most recent comment.

{{threads>[namespace]&[count=n]&[flags]&skipempty}}
[namespace] the namespace for which you want a discussion thread list; : is the top namespace, . is the same namespace as the page lies in, * the whole wiki required
[count=n] the number of discussions which should be displayed (valid values: n > 0) optional
[flags] pagelist flags delimited by &, see flags optional
skipempty Do not print discussions with no comments optional

Default a new thread form is shown below the list. See threads_formposition setting for moving it to the top of the list, or to disable this form.

QnA Plugin

The basic QnA block starts with a question and is followed by one or more optional answers. The questions are marked by triple question mark at the start of a line, the answers — with triple exclamation mark:

??? How do I format a question?
!!! Put triple question mark at the start of a line followed by the question title.

The first line of the question (must be on the same line as the ??? marker) is used as the question title and like DokuWiki headlines does not support any formatting. The rest of the text between the title and the first answer is treated as the question details and can contain almost any DokuWiki syntax (except of headers). This also applies to the answer block — no syntax limitations.

Normally question and answer blocks span until the start of the next block or to the next section. If you want to mix QnA syntax with plain text you can explicitly terminate the block by the question block marker without the question title:

??? How do I terminate a QnA block?
What if I want to put some text after the block and that text doesn't
belong to the answer?

!!! Put triple question mark at the start of a line.
???

This text is not part of the answer.

You can organize multiple questions into sections using slightly modified headline syntax:

=?==== Level 1 headline ======
=?=== Level 2 headline =====
=?== Level 3 headline ====
=?= Level 4 headline ===

The normal headlines are still respected and may be used together with customized ones. The only difference is that they are not shown in the QnA table of contents.

The QnA TOC can be inserted with or syntax. It will be rendered as an unordered list of all questions on the current page. Note that due to implementation constrains the TOC for the current page may be not properly updated in preview during the page editing. Instead of the current page you can insert TOC for other pages by adding the page names to the syntax:

~~QNA faq:installation faq:sequrity faq:usage~~

When multiple page names are specified the plugin will combine information from all pages into a single TOC.

Stars2 Plugin

Stars can be created with two methods:

  1. With the Toolbarbutton Stars 1-5
  2. With Syntax code as shown below
{{stars>num}}
{{stars>}}
{{stars>-1/5}}
{{stars>-5/5}}
{{stars>1/5}}
{{stars>2/5}}
{{stars>3/5}}
{{stars>4/5}}
{{stars>5/5}}
{{stars>5.5/7}}
{{stars>700/1000}}

flowcharts Plugin

With the current version of the plugin it is crucial to remove the following lines from the DokuWiki file conf/entities.conf

<->     ↔
->      →
<-      ←
---     —
--      –

Otherwise, DokuWiki will render -> to → and then the diagrams are not rendered correctly since, e.g. → is the wrong syntax and we need -> etc. (For more information, see entities and also https://github.com/splitbrain/dokuwiki/blob/master/conf/entities.conf)

Alternatively, you can add the arrows in the diagram using

%%-->%%

Examples/Usage

<flow>
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
</flow>

Will be rendered to

A nice feature is that each element of a diagram can be made clickable by using

<flow>
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
click A "SOMEPAGE"
</flow>

Clicking on A will take you to http://yoururl.com/SOMEPAGE.

Syntax

Bookmark

With this plugin you can insert a bookmark to your page. The format is

<BOOKMARK:bookmarkname>

This will insert code

<a name='bookmarkname' id='bookmarkname'></a>

To link to the bookmark from the same page (i.e. to use the bookmark as an anchor link within the page), use this syntax:

[[namespace:page_name#bookmarkname|anchor_text]]

Where anchor_text is the text-link your visitors will see.

Syntax

A basic gallery can be added by selecting a namespace like this:

{{gallery>:namespace}}

All image files in the selected namespace will be added to the image gallery. Don't forget the «:» in front of the namespace.

Instead of using a whole namespace of images, you can also specify a single image – this makes more sense when combined with the lightbox mode (see below).

{{gallery>:namespace:someimage.jpg}}

The created gallery can be aligned by using white space (defaults to centered):

{{gallery> namespace}} (right aligned)
{{gallery>namespace }} (left aligned)
{{gallery> namespace }} (centered)

Instead of a namespace, you can also give an HTTP(s) URL to any Media RSS or ATOM feed with enclosures (as produced by most photo sharing sites like Flickr). The images will then be pulled from that feed instead:

{{gallery>http://www.23hq.com/rss/schabloni}}

Note: since the question mark is used to separate the parameters (see next section) the URL can not contain any question mark. To use such a feed URL with the gallery plugin, just use one of the many short URL services like http://bit.ly.

E.g. instead of http://api.flickr.com/services/feeds/photos_public.gne?id=22019303@N00&lang=en-us&format=rss_200 use a shortened URL like http://bit.ly/HurZM.

Additionally, to have thumbnail creation correctly working you need to set fetchsize big enough to get the remote images downloaded.

Parameters

A number of parameters can be set by appending them with ? character to the namespace or image. Each parameter needs to be separated with a & character. Defaults for all parameters can be set in the config manager. If a parameter is enabled by default it can be disabled in the syntax by prefixing it with the syllable no. E.g. the parameter cache is usually enabled and can be disabled using the keyword nocache. Below is a list of all recognized parameters

Parameter Default Description
<number>x<number> 120x120 Sets the size for thumbnails. Unless the crop option is set, this is a boundary box into which the thumbnail will be fitted, maintaining the correct aspect ratio.
<number>X<number> 800X600 Sets the size for the linked images in direct mode. This is a boundary box into which the image will be fitted, maintaining the correct aspect ratio. Note the uppercase X.
<number> 5 The number images per row in the gallery table. If you specify a 0 no table is used instead all thumbnails are added in a sequence.
=<number> =0 Limits the output to the given number of images. 0 means all.
+<number> +0 Skip the first number of images. Useful with the option above.
~<number> ~0 Add a pagination for the thumbnails displaying the number of given thumbnails per page. 0 disables pagination. Pagination is added through JavaScript - when no JavaScript is available all thumbnails are displayed
cache enabled Usually the output of the created gallery is cached. When the images in your selected namespace change, you have to manually force an update of the gallery page's cache. To disable the cache for the page showing the gallery, set nocache as option.
crop disabled Make thumbnails the exact given thumbnail size big, cropping when needed.
direct disabled Link thumbnails with the bigger sized images not with their detail page
lightbox disabled Show images in a fancy JavaScript modal browsing window, see below for details. Setting this option automatically implies the direct mode
reverse disabled Reverse the order of the displayed images
recursive enabled Find images in the given namespace and all sub namespaces
random disabled Sort images randomly. You might want to use nocache as well
modsort disabled Sort images by file modification date
datesort disabled Sort images by EXIF date
titlesort disabled Sort images by EXIF title
showname disabled Show filename below thumbnails
showtitle disabled Show the EXIF tag Headline as title below thumbnails
anything containing a * jpg,gif,png images This can be used to filter the list of files found in the given namespace. * work as simple wildcard symbol.
Example
{{gallery>images:vacation?image_*.jpg&80x80&crop&lightbox}}

This displays all images beginning with image_ and ending in .jpg from the namespace images:vacation. Thumbnails are cropped to 80×80 pixels and images will be opened in lightbox mode.

Example
{{gallery>?crop&lightbox}}

This displays all images in the current namespace using 2 parameters. Parameterlist begins with ? additional ones are concatenated with &.

About the Lightbox mode

This mode will open the clicked picture inside the current browser window without leaving the current page.

You can close the picture view by clicking the X button in the upper right corner. You can move to the next or previous image by using the arrow buttons in the lower bar. You can also use the keyboard shortcuts listed below for navigation and closing. Mobile users can swipe to navigate and use the back button to close the gallery.

The following keys can be used to navigate:

Key Action
next image
previous image
ESC close the image view

To add footer text to pages in a namespace, you need to create a file named _footer.txt in this namespace.
And to add footer text to pages in the namespace directory and its subdirectories create a file named __footer.txt in the namespace directory.

Files beginning with «_» cannot be created or changed within dokuwiki. Instead you have to create a file and upload it into the wanted namespace. If you don't want this behaviour and you want to maintain data from within dokuwiki you have to define prefixes in the plugin settings, e.g. «hf» and «hfu». In this case you have to create the pages hf_footer and hfu_footer in the namespace directory.

Additional syntax

To avoid a certain page from the footer template (e.g. the start page) you can insert this special command

to the content of this page. Please note that this command is only removed from the page text if there is a footer template exactly for the namespace of this page.

Example

The screenshot above shows this syntax:

a) The content of the page «mynamespace:example» is:

HtmlMetaTags Plugin

  {{htmlmetatags>metatag-keywords=(values) metatag-og:description=(open graph description.)}}

Note: Linebreaks can add inside the {{ }} without any trouble.

  {{htmlmetatags>metatag-keywords=(values)
    metatag-og:description=(open graph description.)
  }}

Syntax

With the string {{htmlmetatags>...}} on the page level you activate the plugin. The leading string «metatag-» marks a tag for the web site. After this leading string followed the key from tag. In =(...) write the value of the tag.

Also, the plugin is on page level.

Example to activate the plugin on your page write:

{{htmlmetatags>metatag-mytag=(some usefull text)}}

The meta tag: mytag is any word. This word is the name of the new meta tag, e.g. keyword. Followed on this name is to write = with ('...'). This brackets contains the text required for the value of the new meta tag.

You can write more than once meta tag on the page separate by space.

{{htmlmetatags>metatag-robots=() 
metatag-keywords=(apfel,bananne,birne) 
metatag-description=(Allgemeiner Obstbauer)
metatag-media-og:image=(:wiki:image.jpg)
metatag-og:description=(anything else)
metatag-og:any=(anything else 2)
}}

The result on web page is:

<meta name="robots" content="noindex,nofollow"/>
<meta name="keywords" content="apfel,bananne,birne"/>
<meta name="description" content="Allgemeiner Obstbauer"/>
<meta property="og:image" content="http://localhost/lib/exe/fetch.php?media=wiki:image.jpg"/>
<meta property="og:description" content="anything else"/>
<meta property="og:any" content="anything else 2"/>
Последнее изменение: 2022/02/12 11:40 (внешнее изменение)