build_DEMOS
pkg-octave-doc: html = build_DEMOS (fcnname)
Build notebook-style HTML for the DEMO blocks of a function or class member.
build_DEMOS collects every %!demo block of fcnname and
returns html, a char string with the generated HTML for all of them.
fcnname is a char string with the name of a function or, for a class
member, a "class/method" path. Each demo is wrapped in the
demos_template.html card layout and titled Example: N. When
fcnname has no demos, html is returned empty.
Notebook layout
Each demo is rendered as an interleaved notebook instead of a single code block trailed by its aggregated output. The demo is split into cells and laid out as a vertical stack of boxes:
disp,
printf, and the like.
assets/
folder of the working directory, shown right after the code that drew them.
Markdown in comments
Comment text uses a small subset of Markdown, not texinfo, so
that the same demo stays readable in the terminal when it is run with the
demo command. The supported constructs are:
`code` rendered as <code>;
**text** and italic *text* emphasis;
[text](url);
- or *
marker, and ordered lists, whose items start with a 1. marker.
All comment text is HTML-escaped before the markup is applied. The following
are deliberately not supported: any texinfo markup; underscore
emphasis _text_, which would mangle identifier names such as
a_b_c; and # headings, which would clash with the Octave
comment marker.
See also: find_DEMOS, function_texi2html, classdef_texi2html
Source Code: build_DEMOS