package quill

  1. Overview
  2. Docs

Module Quill_book.RenderSource

HTML rendering for project notebooks.

Converts notebook documents to HTML pages suitable for a static site. Text cells are rendered via cmarkit. Code cells include syntax-highlighted source and execution outputs.

Sourceval escape_html : string -> string

escape_html s escapes HTML special characters in s.

Sourceval notebook_output_path : Quill_project.notebook -> string

notebook_output_path nb is the output HTML path for nb relative to the project root (e.g. "chapters/01-intro/index.html").

Sourceval chapter_html : Quill.Doc.t -> string

chapter_html doc renders doc to an HTML content fragment. Code cell outputs are rendered after their source blocks: stdout as <pre>, images as <img>, and errors with appropriate styling.

Sourceval toc_html : Quill_project.t -> current:Quill_project.notebook -> root_path:string -> string

toc_html project ~current ~root_path renders the sidebar table of contents with current highlighted as the active notebook. root_path is the relative path from the notebook to the project root (e.g. "../../").

Sourceval page_html : book_title:string -> chapter_title:string -> toc_html:string -> prev:(string * string) option -> next:(string * string) option -> root_path:string -> content:string -> edit_url:string option -> live_reload_script:string -> string

page_html wraps a content fragment in the full page template with navigation. prev and next are (url, title) pairs. root_path is the relative path from the notebook to the project root (e.g. "../../"). edit_url is an optional URL for an "Edit this page" link. live_reload_script is empty for static builds or a <script> tag for live serve mode.

Sourceval strip_html_tags : string -> string

strip_html_tags s removes HTML tags from s and collapses whitespace.

Sourceval replace_all : pattern:string -> with_:string -> string -> string

replace_all ~pattern ~with_ s replaces all occurrences of pattern in s with with_.

Sourceval print_page_html : book_title:string -> chapters:(string * string) list -> string

print_page_html ~book_title ~chapters renders a print page containing all chapters. Each element of chapters is a (title, content_html) pair.