Writers

Writers

Documenter.WritersModule.

A module that provides several renderers for Document objects. The supported formats are currently:

  • :markdown – the default format.

  • :html – generates a complete HTML site with navigation and search included.

  • :latex – generates a PDF using LuaLaTeX.

source

Writes a Documents.Document object to .user.build directory in the formats specified in the .user.format vector.

Adding additional formats requires adding new Selector definitions as follows:

abstract type CustomFormat <: FormatSelector end

Selectors.order(::Type{CustomFormat}) = 4.0 # or a higher number.
Selectors.matcher(::Type{CustomFormat}, fmt, _) = fmt === :custom
Selectors.runner(::Type{CustomFormat}, _, doc) = CustomWriter.render(doc)

# Definition of `CustomWriter` module below...
source

A module for rendering Document objects to markdown.

source

A module for rendering Document objects to HTML.

Keywords

HTMLWriter uses the following additional keyword arguments that can be passed to Documenter.makedocs: assets, sitename, analytics, authors, pages, version, html_prettyurls, html_disable_git.

version specifies the version string of the current version which will be the selected option in the version selector. If this is left empty (default) the version selector will be hidden. The special value git-commit sets the value in the output to git:{commit}, where {commit} is the first few characters of the current commit hash.

html_disable_git can be used to disable calls to git when the document is not in a Git-controlled repository. Without setting this to true, Documenter will throw an error and exit if any of the Git commands fail. The calls to Git are mainly used to gather information about the current commit hash and file paths, necessary for constructing the links to the remote repository.

html_edit_branch specifies which branch, tag or commit the "Edit on GitHub" links point to. It defaults to master. If it set to nothing, the current commit will be used.

html_canonical specifies the canonical URL for your documentation. We recommend you set this to the base url of your stable documentation, e.g. https://juliadocs.github.io/Documenter.jl/stable. This allows search engines to know which version to send their users to. See wikipedia for more information. Default is nothing, in which case no canonical link is set.

Page outline

The HTMLWriter makes use of the page outline that is determined by the headings. It is assumed that if the very first block of a page is a level 1 heading, then it is intended as the page title. This has two consequences:

  1. It is then used to automatically determine the page title in the navigation menu and in the <title> tag, unless specified in the .pages option.

  2. If the first heading is interpreted as being the page title, it is not displayed in the navigation sidebar.

Default and custom assets

Documenter copies all files under the source directory (e.g. /docs/src/) over to the compiled site. It also copies a set of default assets from /assets/html/ to the site's assets/ directory, unless the user already had a file with the same name, in which case the user's files overrides the Documenter's file. This could, in principle, be used for customizing the site's style and scripting.

The HTML output also links certain custom assets to the generated HTML documents, specfically a logo and additional javascript files. The asset files that should be linked must be placed in assets/, under the source directory (e.g /docs/src/assets) and must be on the top level (i.e. files in the subdirectories of assets/ are not linked).

For the logo, Documenter checks for the existence of assets/logo.png. If that's present, it gets displayed in the navigation bar.

Additional JS, ICO, and CSS assets can be included in the generated pages using the assets keyword for makedocs. assets must be a Vector{String} and will include each listed asset in the <head> of every page in the order in which they are listed. The type of the asset (i.e. whether it is going to be included with a <script> or a <link> tag) is determined by the file's extension – either .js, .ico, or .css. Adding an ICO asset is primarilly useful for setting a custom favicon.

source

MDBlockContext is a union of all the Markdown nodes whose children should be blocks. It can be used to dispatch on all the block-context nodes at once.

source

HTMLWriter-specific globals that are passed to domify and other recursive functions.

source

Returns an ordered list of tuples, (toplevel, anchor, text), corresponding to level 1 and 2 headings on the page. Note that if the first header on the page is a level 1 header then it is not included – it is assumed to be the page title and so does not need to be included in the navigation menu twice.

source

Copies an asset from Documenters assets/html/ directory to doc.user.build. Returns the path of the copied asset relative to .build.

source

Converts recursively a Documents.Page, Markdown or Documenter *Node objects into HTML DOM.

source

Replaces URLs in Markdown.Link elements (if they point to a local .md page) with the actual URLs.

source

Returns the full path corresponding to a path of a .md page file. The the input and output paths are assumed to be relative to src/.

source

Returns the full path of a Documents.NavNode relative to src/.

source

Returns a page (as a Documents.Page object) using the HTMLContext.

source

Replaces some of the characters in the string with escape sequences so that the strings would be valid JS string literals, as per the ECMAScript® 2017 standard.

Note that it always escapes both potential " and ' closing quotes.

source

Convert a markdown object to a DOM.Node object.

The parent argument is passed to allow for context-dependant conversions.

source

Get the relative hyperlink between two Documents.NavNodes. Assumes that both Documents.NavNodes have an associated Documents.Page (i.e. .page is not nothing).

source

navitem returns the lists and list items of the navigation menu. It gets called recursively to construct the whole tree.

It always returns a DOM.Node. If there's nothing to display (e.g. the node is set to be invisible), it returns an empty text node (DOM.Node("")).

source

Opens the output file of the navnode in write node. If necessary, the path to the output file is created before opening the file.

source

Tries to guess the page title by looking at the <h1> headers and returns the header contents of the first <h1> on a page (or nothing if the algorithm was unable to find any <h1> headers).

source

If html_prettyurls is enabled, returns a "pretty" version of the path which can then be used in links in the resulting HTML file.

source

Calculates a relative HTML link from one path to another.

source

Constructs and writes the page referred to by the navnode to .build.

source

A module for rendering Document objects to LaTeX and PDF.

source