You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

themes.md 3.0 kB

10 years ago
10 years ago
10 years ago
12345678910111213141516171819202122232425262728
  1. Themes
  2. ======
  3. `Docnet` uses themes to produce output in a certain form. A theme is a folder within the `Themes` folder which contains a `PageTemplate.htm` file and a `Destination` folder which contains zero or more folders and files which have to be copied to the `Destination` folder specified in the `docnet.json` file.
  4. ## Themes folder
  5. `Docnet` expects the `Themes` folder to be located in the folder where the executable is started from. This means that if you build `Docnet` from source, you have to manually copy the Themes folder to the folder your binary is located. To make development easier, you could create a `junction` in the bin\debug or bin\release folder to the Themes folder in the source repository, using `mklink` on a windows command prompt.
  6. ## Default theme
  7. The default theme is called `Default` and is chosen if no theme has been specified in the [docnet.json](docnetjson.htm) file. It is based on the theme from ReadTheDocs, and is created from the one shipped with MkDocs.
  8. ## PageTemplate.htm
  9. The `PageTemplate.htm` file is a simple HTML file, located in each `theme` folder, which is used as the template for all generated `.htm` files. You can place whatever you like in there, including references to css/js files, headers, footers etc. DocNet however expects a couple of *markers* which are replaced with the data created from the markdown files. These markers are described below. The markers have to be specified as-is.
  10. * `{{Name}}`. This is replaced with the value specified in `Name` in the `docnet.json` file.
  11. * `{{Content}}`. This is replaced with the HTML generated from the markdown file.
  12. * `{{ToC}}`. This is replaced with a `<ul><li></li></ul>` tree built from the names and structure given to pages in `Pages`.
  13. * `{{TopicTitle}}`. This is replaced with the title of the page, which is the value specified as name in the `Pages` tree.
  14. * `{{Footer}}`. This is replaced with the value specified in `Footer` in the docnet.json file.
  15. * `{{Breadcrumbs}}`. This is replaced with a / delimited list of names making up the bread crumbs representing the navigation through the ToC to reach the current page.
  16. * `{{RelativeSourceFileName}}`. This is replaced with the source file name relative to the root folder.
  17. * `{{RelativeTargetFileName}}`. This is replaced with the target file name relative to the output folder.
  18. * `{{ExtraScript}}`. This is replaced with extra script definitions / references required by some pages, like the search page. It's `docnet` specific and if this marker isn't present, search won't work.
  19. * `{{Path}}`. This is used to fill in the relative path to reach css/js files in hard-coded URLs in the `PageTemplate` file. This means that specifying a css URL in `PageTemplate` should look like:
  20. ```HTML
  21. <link rel="stylesheet" href="{{Path}}css/theme.css" type="text/css" />
  22. ```
  23. `Docnet` will then replace `{{Path}}` with e.g. '../../' to get to the css file from the location of the .htm file loaded.

No Description