References
References for functions and methods in Haita.
chapter
This function defines a chapter in the output
#chapter("doc/lib.typ")
chapter(str,content:) -> chapterautoautocontent,children:()anychapter,numbered:truebool,any,
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
book
The entrypoint of the entire documentation.
book(title:) -> content""str,description:""str,base-url:nonenonestr,authors:()array,lang:"en"str,html-renderer:new-hamber.html-rendererfunction,paged-renderer:new-hamber.paged-rendererfunction,debug:falsebool,tree:()array,
Parameters
titlestr
The title of the documentation.
descriptionstr
The description of the documentation.
base-urlnoneorstr
The URL the documentation is deployed at, including the subfolder when you are not deploying to the root of a site. Examples include https://<username>.github.io/<project name> for GitHub Pages and https://<project name>.pages.dev for Cloudflare Pages.
This setting is optional: it is only used to build the absolute URLs that SEO metadata requires (the canonical link, Open Graph and Twitter cards).
authorsarray
The authors of the documentation. It should be an array of strings.
langstr
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. Debug mode outputs a tree of the current document at /__debug_tree.html
treearray
The content of your documentation.
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(
image-content: it => [...] // your content here
// Don't complete any other fields
)
)
)
minimal-summary-image-renderer(chapter,base-url:)nonenonestr,width-px:1200int,height-px:630int,ppi:144int,image-content:chapter => nonefunction,
Parameters
chapterchapterPositional
The chapter that would be feeded into the renderer. Usually this is internal to the renderer, and should not be completed.
base-urlnoneorstr
The base URL of your site, taken from book’s base-url. Usually this is internal to the renderer, and should not be completed. When it is none the image is referenced relative to the page instead of by an absolute URL.
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.
html-renderer
New Hamber’s HTML renderer.
html-renderer(,lang:)"en",title:"",base-url:none,summary-image-renderer:none,footer-content:[ Powered by #link("https://github.com/wensimehrp/haita")[Haita]. Made in Vancouver with love. ]content,extra-css:nonenonestr,extra-head-content:nonenonecontent,sidebar-image:html.a( href: "https://en.wikipedia.org/wiki/File:Sea_Otter_(Enhydra_lutris)_(25169790524)_crop.jpg", html.img( class: "w-full h-45 object-cover object-top", src: "https://upload.wikimedia.org/wikipedia/commons/0/02/Sea_Otter_%28Enhydra_lutris%29_%2825169790524%29_crop.jpg", ), )content,favicon:asset("favicon.svg", read("assets/favicon.svg"))contentnone,pagefind-enabled:falsebool,,
Parameters
treePositional
The content tree
lang
The language of the book
title
The title of the book
base-url
The base URL
summary-image-renderer
The summary image renderer
footer-contentcontent
The footer is displayed on each page. Controls the footer’s content.
extra-cssnoneorstr
Extra content to put into the global stylesheet
extra-head-contentnoneorcontent
Extra content to put into head
sidebar-imagecontent
The image of the navigation sidebar
faviconcontentornone
The favicon of the site. Currently only SVG is supported.
pagefind-enabledbool
Whether or not to enable pagefind integration
..argsPositional
paged-renderer
New Hamber’s Paged (PDF, PNG, SVG) renderer.
paged-renderer(,title:)""str,description:[]content,authors:()array,lang:"en"str,date-format:auto,,
Parameters
treePositional
titlestr
The title of the documentation
descriptioncontent
A brief explanation about the document
authorsarray
The author(s) of the document
langstr
The language of the document.
date-format
The date format used