-
Notifications
You must be signed in to change notification settings - Fork 36
Custom themes
There are two ways of customizing your theme:
- Use the default theme and provide some settings (ie. theme colors, logo, website url, title, description). This is nice if you want to style the pages quickly. Check out Default theme examples.
- Create a new theme using template files. This is useful if you want to create complete different new themes or need more specific looks. This can also be used to overwrite specific parts of another theme.
A theme needs a config.json file, which can look like this:
{
"name": "My Custom Theme",
"author": "My name",
"parentTheme": "default"
}
Use the -theme
argument to use the theme. You can look at the default theme to see how to modify to your needs. A theme can also inherit from another theme, using parentTheme
. This allows to overwrite specific templates of a parent theme. The Haxe API documentation for example uses this, check out its theme files how it is structured. It extends the default theme and only changes the topbar, footer and package description.
Each theme can use resources like images/stylesheets/JavaScript files etc. By default these are placed in the "resources". When documentation is generated, the files are copied into the root folder of the output.
To link correctly to a resource correctly, use the config.rootPath
in the template like this:
<img src="::api.config.rootPath::images/myImage.jpg" />
All templates are .mtt files which are templo templates. Templates contain expressions delimited by :: ::
just like the haxe.Template
syntax.
Check out the templo template syntax here: https://github.com/ncannasse/templo
If you want to use a custom setting/define in the theme:
<div ::cond api.isDefined("my_setting")::>This is my setting: ::api.getValue('my_setting')::</div>
Learn Haxe: Introduction | Manual | API | Try Haxe | Haxe Library Manager | Code Cookbook
Connect: GitHub | Stack Overflow | Forum | Chat | Twitter | Facebook