References
References for functions in Otter Docs.
chapter
This function defines a chapter in the output
#chapter("doc/lib.typ")
chapter(str,content: auto autocontent,children: () anychapter,numbered: true bool,any,) -> chapter
Parameters
pathstrPositional
The path to the chapter. When content is left blank the function would automatically look into the current directory and fetch the content if there is a file at the path ending in .typ
contentautoorcontent
The content of the chapter.
childrenanyorchapter
Subchapters
numberedbool
Whether if this chapter is numbered
..argsanyPositional
Extra arguments passed to the renderer
separator
Creates a separator in the summary.
separator() -> summary-item
Parameters
This function does not have any parameters.
book
The entrypoint of the entire documentation.
book(title: "" str,description: "" str,canonical-url: "" str,render-summary-image: true bool,authors: () array,root: () strarray,language: "en" str,html-renderer: (..args) => new-hamber.html-renderer.with( summary-image-renderer: if args.named().render-summary-image { new-hamber.summary-image-renderer.with( args.named().title, args.named().canonical-url, ) } else { none }, )(..args) function,paged-renderer: new-hamber.paged-renderer function,debug: false bool,tree: () array,any,) -> content
Parameters
titlestr
The title of the documentation.
descriptionstr
The description of the documentation.
canonical-urlstr
The canonical URL of the documentation, e.g. the site’s domain when you deploy the documentation to a website. Examples include <username>.github.io for GitHub Pages and <project name>.pages.dev for Cloudflare Pages.
render-summary-imagebool
Whether or not to render the summary images. Summary images are displayed when pasting pages’ link in various social media, such as Telegram, Discord, and X.
authorsarray
The authors of the documentation. It should be an array of strings.
rootstrorarray
The root of the site. Set this when you are not deploying the documentation to the root of your website, instead you’re deploying it to a subfolder. E.g., when deploying to GitHub Pages.
languagestr
The language of the documentation
html-rendererfunction
Which HTML renderer to use. By default it uses New Hamber’s html renderer.
paged-rendererfunction
Which paged (PDF, PNG, SVG) renderer to use. By default it uses New Hamber’s paged renderer.
debugbool
Whether to enable the debug mode or not.
treearray
The content of your documentation.
..argsanyPositional
Extra arguments that are passed to the renderers.
minimal-summary-image-renderer
Minimal page summary renderer. Use it like this. Always use it with the .with syntax:
#book(
html-renderer: new-hamber.html-renderer.with(
summary-image-renderer: lib.minimal-summary-image-renderer.with(
<your-url-here>, // place your canonical url here. MANDATORY FIELD
image-content: it => [...] // your content here
// Don't complete any other fields
)
)
)
minimal-summary-image-renderer(str,chapter,width-px: 1200 int,height-px: 630 int,ppi: 144 int,image-content: chapter => none function,)
Parameters
canonical-urlstrPositional
The canonical URL of your site. This is completed by the user
chapterchapterPositional
The chapter that would be feeded into the renderer. Usually this is internal to the renderer, and should not be completed.
width-pxint
The width of the image in pixels. For the default PPI it is 1pt -> 1px.
height-pxint
The height of the image in pixels. For the default PPI it is 1pt -> 1px.
ppiint
The PPI of the image in pixels. If you change the PPI via the --ppi when compiling you must also change this value.
image-contentfunction
The content of the summary image.