1444
|
1 |
#summary The reference to the wiki syntax for the Hedgewars Knowledge Base
|
590
|
2 |
= Wiki Syntax =
|
|
3 |
<wiki:toc max_depth="2" />
|
|
4 |
|
|
5 |
= Introduction =
|
|
6 |
|
1448
|
7 |
This page describes the wiki syntax of the Hedgewars Knowledge Base.
|
|
8 |
|
|
9 |
Each wiki page is stored in a `.wiki` file in the [https://hg.hedgewars.org/hwkb/ hwkb repository].
|
|
10 |
There are just text files with some simple markup.
|
|
11 |
Each file's name is the same as the wiki page name. And, each wiki file consists of optional
|
|
12 |
pragma lines followed by the content of the page.
|
590
|
13 |
|
|
14 |
= Pragmas =
|
|
15 |
|
|
16 |
Optional pragma lines provide metadata about the page and how it should be
|
|
17 |
displayed. These lines are only processed if they appear at the top of
|
|
18 |
the file. Each pragma line begins with a pound-sign (#) and the
|
|
19 |
pragma name, followed by a value.
|
|
20 |
|
|
21 |
|| *Pragma* || *Value* ||
|
|
22 |
|| #summary || One-line summary of the page ||
|
1458
|
23 |
|| #labels || Comma-separated list of labels ||
|
590
|
24 |
|
|
25 |
= Wiki-style markup =
|
|
26 |
|
|
27 |
== Paragraphs ==
|
|
28 |
|
|
29 |
Use one or more blank lines to separate paragraphs.
|
|
30 |
|
|
31 |
== Typeface ==
|
|
32 |
|
|
33 |
||* Name/Sample* || * Markup * ||
|
|
34 |
|| _italic_ || `_italic_` ||
|
|
35 |
|| *bold* || `*bold*` ||
|
|
36 |
|| `code` || {{{`code`}}} ||
|
|
37 |
|| {{{code}}} || `{{{code}}}` ||
|
|
38 |
|| ^super^script || `^super^script` ||
|
|
39 |
|| ,,sub,,script || `,,sub,,script` ||
|
|
40 |
|| ~~strikeout~~ || `~~strikeout~~` ||
|
|
41 |
|
|
42 |
You can mix these typefaces in some ways:
|
|
43 |
|
|
44 |
|| *Markup* || *Result* ||
|
|
45 |
|| `_*bold* in italics_` || _*bold* in italics_ ||
|
|
46 |
|| `*_italics_ in bold*` || *_italics_ in bold* ||
|
|
47 |
|| `*~~strike~~ works too*` || *~~strike~~ works too* ||
|
|
48 |
|| `~~as well as _this_ way round~~` || ~~as well as _this_ way round~~ ||
|
|
49 |
|
|
50 |
== Code ==
|
|
51 |
|
|
52 |
If you have a multiline code block that you want to display verbatim,
|
|
53 |
use the multiline code delimiter:
|
|
54 |
|
|
55 |
{{{
|
|
56 |
{{{
|
|
57 |
def fib(n):
|
|
58 |
if n == 0 or n == 1:
|
|
59 |
return n
|
|
60 |
else:
|
|
61 |
# This recursion is not good for large numbers.
|
|
62 |
return fib(n-1) + fib(n-2)
|
|
63 |
}}}
|
|
64 |
}}}
|
|
65 |
|
|
66 |
Which results in:
|
|
67 |
|
|
68 |
{{{
|
|
69 |
def fib(n):
|
|
70 |
if n == 0 or n == 1:
|
|
71 |
return n
|
|
72 |
else:
|
|
73 |
# This recursion is not good for large numbers.
|
|
74 |
return fib(n-1) + fib(n-2)
|
|
75 |
}}}
|
|
76 |
|
1453
|
77 |
The `<code>` tag allows you to specify a file extension (note: syntax highlighting is not implemented yet):
|
590
|
78 |
|
|
79 |
{{{
|
|
80 |
<code language="xml">
|
|
81 |
<hello target="world"/>
|
|
82 |
</code>
|
|
83 |
}}}
|
|
84 |
|
1453
|
85 |
The `<pre>` tag is like the code tag, but will never use syntax highlighting.
|
590
|
86 |
|
|
87 |
== Headings ==
|
|
88 |
|
|
89 |
{{{
|
|
90 |
= Heading =
|
|
91 |
== Subheading ==
|
|
92 |
=== Level 3 ===
|
|
93 |
==== Level 4 ====
|
|
94 |
===== Level 5 =====
|
|
95 |
====== Level 6 ======
|
|
96 |
}}}
|
|
97 |
|
|
98 |
== Dividers ==
|
|
99 |
|
|
100 |
Four or more dashes on a line by themselves results in a horizontal rule.
|
|
101 |
|
|
102 |
|
|
103 |
== Lists ==
|
|
104 |
|
1444
|
105 |
The HWKB wiki supports both bulleted and numbered lists. A list
|
590
|
106 |
must be indented at least one space to be recognized as such. You can
|
|
107 |
also nest lists one within the other by appropriate use of indenting:
|
|
108 |
|
|
109 |
{{{
|
|
110 |
The following is:
|
|
111 |
* A list
|
|
112 |
* Of bulleted items
|
|
113 |
# This is a numbered sublist
|
|
114 |
# Which is done by indenting further
|
|
115 |
* And back to the main bulleted list
|
|
116 |
|
|
117 |
* This is also a list
|
|
118 |
* With a single leading space
|
|
119 |
* Notice that it is rendered
|
|
120 |
# At the same levels
|
|
121 |
# As the above lists.
|
|
122 |
* Despite the different indentation levels.
|
|
123 |
}}}
|
|
124 |
|
|
125 |
The following is:
|
|
126 |
* A list
|
|
127 |
* Of bulleted items
|
|
128 |
# This is a numbered sublist
|
|
129 |
# Which is done by indenting further
|
|
130 |
* And back to the main bulleted list
|
|
131 |
|
|
132 |
* This is also a list
|
|
133 |
* With a single leading space
|
|
134 |
* Notice that it is rendered
|
|
135 |
# At the same levels
|
|
136 |
# As the above lists.
|
|
137 |
* Despite the different indentation levels.
|
|
138 |
|
|
139 |
== Links ==
|
|
140 |
|
|
141 |
Links are central to the wiki principle, as they create the web of
|
1444
|
142 |
content. The HWKB wiki permits both internal (within the wiki) and
|
590
|
143 |
external links, and in some cases automatically creates a link when it
|
|
144 |
recognizes either a !WikiWord or an URL.
|
|
145 |
|
|
146 |
=== Internal wiki links ===
|
|
147 |
|
|
148 |
Internal links within a wiki are created using the syntax below. If
|
|
149 |
you add a wiki link to a page that does not exist, the link will
|
|
150 |
appear with a !LittleLink[WikiSyntax ?] to project committers and
|
|
151 |
owners. Clicking that link will take you to the page creation form
|
|
152 |
where you can enter content for that page.
|
|
153 |
|
|
154 |
If you are not logged in, wiki links that point to non-existent pages
|
|
155 |
will appear as plain text, without the link to the page creation
|
|
156 |
form. When you create the target page,
|
|
157 |
the link will become a normal hyperlink for all viewers of
|
|
158 |
the page.
|
|
159 |
|
|
160 |
{{{
|
|
161 |
WikiSyntax is identified and linked automatically
|
|
162 |
|
|
163 |
Wikipage is not identified, so if you have a page named [Wikipage] you
|
|
164 |
need to link it explicitly.
|
|
165 |
|
|
166 |
If the WikiSyntax page is actually about reindeers, you can provide a
|
|
167 |
description, so that people know you are actually linking to a page on
|
|
168 |
[WikiSyntax reindeer flotillas].
|
|
169 |
|
|
170 |
If you want to mention !WikiSyntax without it being autolinked, use an
|
|
171 |
exclamation mark to prevent linking.
|
|
172 |
}}}
|
|
173 |
|
|
174 |
WikiSyntax is identified and linked automatically
|
|
175 |
|
|
176 |
Wikipage is not identified, so if you have a page named [Wikipage] you
|
|
177 |
need to link it explicitly.
|
|
178 |
|
|
179 |
If the WikiSyntax page is actually about reindeers, you can provide a
|
|
180 |
description, so that people know you are actually linking to a page on
|
|
181 |
[WikiSyntax reindeer flotillas].
|
|
182 |
|
|
183 |
If you want to mention !WikiSyntax without it being autolinked, use an
|
|
184 |
exclamation mark to prevent linking.
|
|
185 |
|
|
186 |
=== Links to anchors within a page ===
|
|
187 |
|
|
188 |
Each heading defines a HTML anchor with the same name as the heading, but with spaces replaced by underscores. You can
|
|
189 |
create a link to a specific heading on a page like this:
|
|
190 |
|
|
191 |
{{{
|
|
192 |
[WikiSyntax#Wiki-style_markup]
|
|
193 |
}}}
|
|
194 |
|
|
195 |
And it will render as: [WikiSyntax#Wiki-style_markup].
|
|
196 |
|
1736
|
197 |
==== Header disambiguation ====
|
|
198 |
|
|
199 |
Sometimes the page needs multiple headers with the same name. In this case, the normal header link will always lead to the first header. If you want to link to the *n*th header (starting with 2), append two underscores and the number *n*.
|
|
200 |
|
1737
|
201 |
For example, to link to the third header named “Header” in the page “!WikiSyntax”, use `[WikiSyntax#Header__3]`.
|
1736
|
202 |
|
590
|
203 |
=== Links to external pages ===
|
|
204 |
|
|
205 |
You can of course link to external pages from your own wiki pages,
|
|
206 |
using a syntax similar to that for internal links:
|
|
207 |
|
|
208 |
{{{
|
1444
|
209 |
Plain URLs such as https://www.example.org/ automatically made into links.
|
590
|
210 |
|
|
211 |
You can also provide some descriptive text. For example, the following
|
1444
|
212 |
link points to the [https://www.example.org Example homepage].
|
590
|
213 |
|
|
214 |
If your link points to an image, it will get inserted as an image tag
|
|
215 |
into the page:
|
|
216 |
|
1454
|
217 |
https://www.hedgewars.org/images/hwkb_example.png
|
590
|
218 |
|
|
219 |
You can also make the image into a link, by setting the image URL as
|
|
220 |
the description of the URL you want to link:
|
|
221 |
|
1454
|
222 |
[https://www.hedgewars.org/ https://www.hedgewars.org/images/hwkb_example.png]
|
590
|
223 |
}}}
|
|
224 |
|
1444
|
225 |
Plain URLs such as https://www.example.org/ automatically made into links.
|
590
|
226 |
|
|
227 |
You can also provide some descriptive text. For example, the following
|
1444
|
228 |
link points to the [https://www.example.org Example homepage].
|
|
229 |
|
|
230 |
If your link points to an image, it will get inserted as an image tag
|
|
231 |
into the page:
|
|
232 |
|
1449
|
233 |
https://www.hedgewars.org/images/hwkb_example.png
|
590
|
234 |
|
|
235 |
You can also make the image into a link, by setting the image URL as
|
|
236 |
the description of the URL you want to link:
|
|
237 |
|
1449
|
238 |
[https://www.hedgewars.org/ https://www.hedgewars.org/images/hwkb_example.png]
|
590
|
239 |
|
|
240 |
=== Links to images ===
|
|
241 |
|
|
242 |
If your link points to an image (that is, if it ends in `.png`,
|
|
243 |
`.gif`, `.jpg` or `.jpeg`), it will get inserted as an image into the
|
|
244 |
page:
|
|
245 |
|
|
246 |
{{{
|
1449
|
247 |
https://www.hedgewars.org/images/hwkb_example.png
|
590
|
248 |
}}}
|
|
249 |
|
1449
|
250 |
https://www.hedgewars.org/images/hwkb_example.png
|
590
|
251 |
|
1451
|
252 |
If the URL of the image does not end with a standard file name suffix such as `.png`, you may need to add a `nonsense` query string parameter to the end so that the URL ends with a supported image filename extension. For example, for the URL `https://www.hedgewars.org/images/hwkb_example_weird_suffix.foo` (which refers to a PNG image), you could write instead:
|
590
|
253 |
|
|
254 |
{{{
|
1451
|
255 |
https://www.hedgewars.org/images/hwkb_example_weird_suffix.foo?nonsense=something_that_ends_with.png
|
590
|
256 |
}}}
|
|
257 |
|
1451
|
258 |
https://www.hedgewars.org/images/hwkb_example_weird_suffix.foo?nonsense=something_that_ends_with.png
|
590
|
259 |
|
|
260 |
== Tables ==
|
|
261 |
|
|
262 |
Tables are created by entering the content of each cell separated by
|
|
263 |
{{{||}}} delimiters. You can insert other inline wiki syntax in table
|
|
264 |
cells, including typeface formatting and links.
|
|
265 |
|
|
266 |
{{{
|
|
267 |
|| *Year* || *Temperature (low)* || *Temperature (high)* ||
|
|
268 |
|| 1900 || -10 || 25 ||
|
|
269 |
|| 1910 || -15 || 30 ||
|
|
270 |
|| 1920 || -10 || 32 ||
|
|
271 |
|| 1930 || _N/A_ || _N/A_ ||
|
|
272 |
|| 1940 || -2 || 40 ||
|
|
273 |
}}}
|
|
274 |
|
|
275 |
|| *Year* || *Temperature (low)* || *Temperature (high)* ||
|
|
276 |
|| 1900 || -10 || 25 ||
|
|
277 |
|| 1910 || -15 || 30 ||
|
|
278 |
|| 1920 || -10 || 32 ||
|
|
279 |
|| 1930 || _N/A_ || _N/A_ ||
|
|
280 |
|| 1940 || -2 || 40 ||
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
= HTML support =
|
|
290 |
To aid in the presentation of a wiki page there is some support for HTML. HTML tags are only supported in wiki pages, not in page comments.
|
|
291 |
|
1460
|
292 |
HTML syntax can be used in conjunction with wiki syntax, but it is recommended against doing so where possible.
|
590
|
293 |
|
|
294 |
The following HTML tags and attributes are currently supported:
|
|
295 |
|
|
296 |
<table border=1>
|
|
297 |
<thead><th>HTML Tag</th><th>Supported Attributes</th></thead>
|
|
298 |
<tbody>
|
|
299 |
<tr><td>a</td><td>title dir lang href</td></tr>
|
|
300 |
<tr><td>b</td><td>title dir lang</td></tr>
|
|
301 |
<tr><td>br</td><td>title dir lang</td></tr>
|
|
302 |
<tr><td>blockquote</td><td>title dir lang</td></tr>
|
1453
|
303 |
<tr><td>code</td><td>title dir lang</td></tr>
|
590
|
304 |
<tr><td>dd</td><td>title dir lang</td></tr>
|
|
305 |
<tr><td>div</td><td>title dir lang</td></tr>
|
|
306 |
<tr><td>dl</td><td>title dir lang</td></tr>
|
|
307 |
<tr><td>dt</td><td>title dir lang</td></tr>
|
|
308 |
<tr><td>em</td><td>title dir lang</td></tr>
|
|
309 |
<tr><td>font</td><td>title dir lang face size color</td></tr>
|
|
310 |
<tr><td>h1</td><td>title dir lang</td></tr>
|
|
311 |
<tr><td>h2</td><td>title dir lang</td></tr>
|
|
312 |
<tr><td>h3</td><td>title dir lang</td></tr>
|
|
313 |
<tr><td>h4</td><td>title dir lang</td></tr>
|
|
314 |
<tr><td>h5</td><td>title dir lang</td></tr>
|
|
315 |
<tr><td>i</td><td>title dir lang</td></tr>
|
|
316 |
<tr><td>img</td><td>title dir lang src alt border height width align</td></tr>
|
|
317 |
<tr><td>li</td><td>title dir lang</td></tr>
|
|
318 |
<tr><td>ol</td><td>title dir lang type start</td></tr>
|
|
319 |
<tr><td>p</td><td>title dir lang align</td></tr>
|
|
320 |
<tr><td>pre</td><td>title dir lang</td></tr>
|
|
321 |
<tr><td>q</td><td>title dir lang</td></tr>
|
|
322 |
<tr><td>s</td><td>title dir lang</td></tr>
|
|
323 |
<tr><td>span</td><td>title dir lang</td></tr> <tr><td>strike</td><td>title dir lang</td></tr> <tr><td>strong</td><td>title dir lang</td></tr>
|
|
324 |
<tr><td>sub</td><td>title dir lang</td></tr>
|
|
325 |
<tr><td>sup</td><td>title dir lang</td></tr>
|
|
326 |
<tr><td>table</td><td>title dir lang align valign cellspacing cellpadding border width height</td></tr>
|
|
327 |
<tr><td>tbody</td><td>title dir lang align valign cellspacing cellpadding border width height</td></tr>
|
|
328 |
<tr><td>td</td><td>title dir lang align valign cellspacing cellpadding border width height</td></tr>
|
|
329 |
<tr><td>tfoot</td><td>title dir lang align valign cellspacing cellpadding border width height</td></tr>
|
|
330 |
<tr><td>th</td><td>title dir lang align valign cellspacing cellpadding border width height</td></tr>
|
|
331 |
<tr><td>thead</td><td>title dir lang align valign cellspacing cellpadding border width height colspan rowspan</td></tr>
|
|
332 |
<tr><td>tr</td><td>title dir lang align valign cellspacing cellpadding border width height colspan rowspan</td></tr>
|
|
333 |
<tr><td>tt</td><td>title dir lang</td></tr>
|
|
334 |
<tr><td>u</td><td>title dir lang</td></tr>
|
|
335 |
<tr><td>ul</td><td>title dir lang type</td></tr>
|
|
336 |
<tr><td>var</td><td>title dir lang</td></tr> </tbody>
|
|
337 |
</table>
|
|
338 |
|
|
339 |
== Escaping HTML Tags ==
|
|
340 |
|
|
341 |
When you want to display html tags directly on your wiki page (as opposed to rendered), you will need to escape each HTML tag.
|
|
342 |
|
|
343 |
HTML tags can be escaped as shown in the table below:
|
|
344 |
<table border="1">
|
|
345 |
<thead><th>Markup</th><th>Result</th></thead>
|
|
346 |
<tbody>
|
|
347 |
<tr><td> {{{`<hr>`}}}</td><td>`<hr>`</td></tr>
|
|
348 |
<tr><td> `{{{<hr>}}}`</td><td>{{{<hr>}}}</td></tr>
|
|
349 |
</tbody>
|
|
350 |
</table>
|
|
351 |
|
1851
|
352 |
= Comments =
|
|
353 |
|
|
354 |
The wiki supports embedded comments to help explain the contents of a wiki page. Anything inside the comment block is removed from the rendered page, but is visible when editing or viewing the source for that page.
|
|
355 |
|
|
356 |
{{{
|
|
357 |
<wiki:comment>
|
|
358 |
This text will be removed from the rendered page.
|
|
359 |
</wiki:comment>
|
|
360 |
}}}
|
|
361 |
|
590
|
362 |
= Navigation =
|
|
363 |
== Table of Contents ==
|
|
364 |
|
|
365 |
An inline table of contents can be generated from page headers on a wiki page. Add the following syntax to a page in the location the table of contents should be displayed:
|
|
366 |
|
|
367 |
{{{
|
|
368 |
<wiki:toc max_depth="1" />
|
|
369 |
}}}
|
|
370 |
|
|
371 |
Valid attributes are:
|
|
372 |
* `max_depth`: the maximum header depth to display in the table of contents
|
|
373 |
|
|
374 |
== Side navigation ==
|
|
375 |
|
1446
|
376 |
The sidebar is just another wiki page and defined in the special page [TableOfContents].
|
590
|
377 |
|
1446
|
378 |
The side navigation that is defined should be in the format of a simple list, as shown below:
|
590
|
379 |
|
|
380 |
{{{
|
|
381 |
* [Articles HOWTO articles]
|
|
382 |
* [ArticlesXSS Web security]
|
|
383 |
* [ArticlesDom DOM manipulation]
|
|
384 |
* [ArticlesStyle CSS and style]
|
|
385 |
* [ArticlesTips Tips and tricks]
|
|
386 |
* [DOMReference DOM reference]
|
|
387 |
* [HTMLElements HTML reference]
|
|
388 |
* [CSSReference CSS reference]
|
|
389 |
}}}
|
|
390 |
|
1445
|
391 |
----
|
590
|
392 |
|
1448
|
393 |
_The content on this page is based on the old Google Code documentation for Google Code wikis and has been adapted and changed to fit the Hedgewars Knowledge Base. The original document by Google is licensed under the [http://creativecommons.org/licenses/by/3.0/ Creative Commons Attribution 3.0 License]. User-generated content is not included in this license._ |