# wiki command

## Contents

- Purpose and Syntax
- Command Parameters

- encoding
- htmlescape
- wikiparse

## Purpose and Syntax

The (:include:) command is designed to insert the content of attached files directly into a wiki page. The syntax is as follows:
(:include Attach:filename [params...]:)
Here, filename is the name of the attachment whose content you want to embed in the page text.
Additional command parameters are detailed below.

## Command Parameters

The (:include:) command accepts the optional parameters described in the following sections.

### encoding

The encoding parameter specifies the character encoding of the inserted text. Since OutWiker cannot automatically detect a file's encoding, it assumes UTF-8 by default.
For example, to insert the file text_utf8.txt (attached to this page and created in UTF-8), simply use:
(:include Attach:text_utf8.txt:)
The result will be:
Текст в
кодировке UTF-8
You can also specify the encoding explicitly for the same file:
(:include Attach:text_utf8.txt encoding=utf8 :)
To insert the contents of text_1251.txt using the cp1251 encoding, the command would look like this:
(:include Attach:text_1251.txt encoding=cp1251:)
Result:
Это текст
в кодировке 1251
If you forget to specify an encoding other than UTF-8, or if you provide an incorrect one, an error will occur. For instance, the command:
(:include Attach:text_1251.txt:)
Will result in the following error text:
Ошибка кодировки файла 'text_1251.txt'
The list of supported encodings is quite extensive and can be found on this Python documentation page. Common encodings include (note that the same encoding may have multiple aliases):

- utf8, utf-8, utf_8, U8, UTF;
- cp1251, windows-1251;
- koi8_r;
- koi8_u;
- utf_32, utf-32, utf32;
- utf_16, utf-16, utf16;
- mac_cyrillic, maccyrillic;
- cp866, 866, IBM866;

### htmlescape

The htmlescape parameter instructs the (:include:) command to escape HTML characters in the source file. It replaces <, >, and & with &lt;, &gt;, and &amp; respectively. This is particularly useful for displaying source code from attached files.
For example, the following command without the htmlescape parameter would display text in bold because the file contains <b>...</b> tags:
(:include Attach:html.txt:)
Result:
This text contains HTML tags
However, by adding the htmlescape parameter:
(:include Attach:html.txt htmlescape:)
The raw HTML code will be displayed instead:
<b>This text contains HTML tags</b>

### wikiparse

The wikiparse parameter tells the (:include:) command to pass the file content through the wiki notation parser. This is used when the attached file contains wiki markup that needs to be converted to HTML for proper rendering.
For example, since the file wiki.txt contains wiki notation, the command:
(:include Attach:wiki.txt:)
Will simply display the raw text:
'''This text contains wiki notation'''
But with the wikiparse parameter:
(:include Attach:wiki.txt wikiparse :)
The wiki notation is parsed and rendered as HTML on the page:
This text contains wiki notation
If both htmlescape and wikiparse parameters are set in the (:include:) command, the HTML characters are escaped first, followed by the wiki notation parsing.

See also:

- Wiki commands
- Text Formating
- (:attachlist:) command
- (:childlist:) command