# Creating page styles

A page style is a directory that must contain a __style.html file and an optional __style subdirectory.
The content of __style.html is a standard HTML file in UTF-8 encoding that contains some substitution macros. During the generation of the final page view, these macros are replaced with the page content or additional parameters described below. For example, this is what the default style looks like:

    <html>
    <head>
        <meta http-equiv='content-type' content='text/html; charset=utf-8'/>

        <style type="text/css">
            body, div, p, table {
                font-size:${fontsize}pt;
                font-family:$fontfamily;
            }

            img{border:none}
            $userstyle
        </style>
        $userhead
    </head>

    <body>
    <P>$content</P>
    </body>
    </html>

## Substitution macros

The __style.html file contains special substitution macros that start with the "$" character followed by the macro name, optionally surrounded by curly braces, for example: $content or ${content}. The second case is needed if the macro must be followed immediately by some text without spaces. Currently, page styles support the following substitution macros:

- $content - replaced with the page content.
- $fontsize - the font size set in the settings. Measured in points (pt).
- $fontfamily - the font family name set in the settings.
- $userstyle - additional styles that may be created during the wiki page parsing.
- $userhead - additional tags inside the <head>...</head> tag that may be created during the wiki page parsing.

The __style subdirectory is optional. It can contain images and CSS files. However, it is not recommended to store CSS styles in this directory; it is better to place them directly in the __style.html file. This is primarily due to style caching when running the program under Linux. If several styles have CSS files with the same names, these files might not be updated immediately during HTML rendering when switching between such styles.

See also:

- Page styles