.\" Copyright (c) Kristaps Dzonsons .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate$ .Dt LOWDOWN 3 .Os .Sh NAME .Nm lowdown .Nd simple markdown translator library .Sh LIBRARY .Lb liblowdown .Sh SYNOPSIS .In sys/queue.h .In stdio.h .In lowdown.h .Vt "struct lowdown_meta" .Vt "struct lowdown_node" .Vt "struct lowdown_opts" .Sh DESCRIPTION This library parses .Xr lowdown 5 into various output formats. .Pp The library consists first of a high-level interface consisting of .Xr lowdown_buf 3 , .Xr lowdown_buf_diff 3 , .Xr lowdown_file 3 , and .Xr lowdown_file_diff 3 . .Pp The high-level functions interface with low-level functions that perform parsing and formatting. These consist of .Xr lowdown_doc_new 3 , .Xr lowdown_doc_parse 3 , and .Xr lowdown_doc_free 3 for parsing .Xr lowdown 5 documents into an abstract syntax tree. .Pp The front-end functions for freeing, allocation, and rendering are as follows. .Bl -bullet .It HTML5: .Bl -item -compact .It .Xr lowdown_html_free 3 .It .Xr lowdown_html_new 3 .It .Xr lowdown_html_rndr 3 .El .It gemini: .Bl -item -compact .It .Xr lowdown_gemini_free 3 .It .Xr lowdown_gemini_new 3 .It .Xr lowdown_gemini_rndr 3 .El .It LaTeX: .Bl -item -compact .It .Xr lowdown_latex_free 3 .It .Xr lowdown_latex_new 3 .It .Xr lowdown_latex_rndr 3 .El .It OpenDocument: .Bl -item -compact .It .Xr lowdown_odt_free 3 .It .Xr lowdown_odt_new 3 .It .Xr lowdown_odt_rndr 3 .El .It roff: .Bl -item -compact .It .Xr lowdown_nroff_free 3 .It .Xr lowdown_nroff_new 3 .It .Xr lowdown_nroff_rndr 3 .El .It UTF-8 ANSI terminal: .Bl -item -compact .It .Xr lowdown_term_free 3 .It .Xr lowdown_term_new 3 .It .Xr lowdown_term_rndr 3 .El .It debugging: .Bl -item -compact .It .Xr lowdown_tree_rndr 3 .El .El .Pp To compile and link, use .Xr pkg-config 1 : .Bd -literal % cc `pkg-config --cflags lowdown` -c -o sample.o sample.c % cc -o sample sample.o `pkg-config --libs lowdown` .Ed .Ss Pledge Promises The .Nm lowdown library is built to operate in security-sensitive environments, such as those using .Xr pledge 2 on .Ox . The only promise required is .Va stdio for .Xr lowdown_file_diff 3 and .Xr lowdown_file 3 : both require access to the stream for reading input. .Sh TYPES All .Nm lowdown functions use one or more of the following structures. .Pp The main structure for configuring parsing and output is .Vt struct lowdown_opts . It has the following fields: .Bl -tag -width Ds .It Va enum lowdown_type type The output medium: .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_HTML HTML5 .It Dv LOWDOWN_LATEX LaTeX .It Dv LOWDOWN_MAN roff .Fl m Ns Ar an macros .It Dv LOWDOWN_FODT .Dq flat OpenDocument .It Dv LOWDOWN_TERM ANSI-compatible UTF-8 terminal output .It Dv LOWDOWN_GEMINI Gemini format .It Dv LOWDOWN_NROFF roff .Fl m Ns Ar s macros .It Dv LOWDOWN_TREE syntax tree (debugging) .El .It Va unsigned int feat Parse-time features. This bit-field may have the following bits OR'd: .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_ATTRS Parse PHP extra link, header, and image attributes. .It Dv LOWDOWN_AUTOLINK Parse .Li http , .Li https , .Li ftp , .Li mailto , and relative links or link fragments. .It Dv LOWDOWN_CALLOUTS Parse MDN/GFM callouts .Pq Dq admonitions . .It Dv LOWDOWN_COMMONMARK Tighten input parsing to the CommonMark specification. This also uses the first ordered list value instead of starting all lists at one. This feature is .Em experimental and .Em incomplete . .It Dv LOWDOWN_DEFLIST Parse PHP extra definition lists. This is currently constrained to single-key lists. .It Dv LOWDOWN_FENCED Parse GFM fenced (language-specific) code blocks. .It Dv LOWDOWN_FOOTNOTES Parse MMD style footnotes. This only supports the referenced footnote style, not the .Dq inline style. .It Dv LOWDOWN_HILITE Parse highlit sequences. This are disabled by default because it may be erroneously interpreted as section headers. .It Dv LOWDOWN_IMG_EXT Deprecated. Use .Dv LOWDOWN_ATTRS instead. .It Dv LOWDOWN_MANTITLE Recognise manpage titles in Pandoc metadata title lines. Only applicable if .Dv LOWDOWN_METADATA is also provided. Manpages titles must begin with a non-empty title followed by an open parenthesis, digit or .Dq n , optional letters after, then a closing parenthesis. This may be optionally followed by a source and, if a vertical bar is detected, the content after as the volume. These are passed to the renderers as the .Li title , .Li volume , and optionally .Li source and .Li volume metadata key-value pairs. The original title is not recoverable. .It Dv LOWDOWN_MATH Parse mathematics equations. .It Dv LOWDOWN_METADATA Parse in-document metadata. .It Dv LOWDOWN_NOCODEIND Do not parse indented content as code blocks. .It Dv LOWDOWN_NOINTEM Do not parse emphasis within words. .It Dv LOWDOWN_STRIKE Parse strikethrough sequences. .It Dv LOWDOWN_SUPER Parse super-scripts. This accepts foo^bar^ GFM super-scripts. .It Dv LOWDOWN_SUPER_SHORT If .Dv LOWDOWN_SUPER is enabled, instead of the GFM style, accept the .Dq short form of superscript. This accepts foo^bar, which puts the parts following the caret until whitespace in superscripts; or foo^(bar), which puts only the parts in parenthesis. .It Dv LOWDOWN_TABLES Parse GFM tables. .It Dv LOWDOWN_TASKLIST Parse GFM task list items. .El .It Va unsigned int oflags Output-time features. Bit values are specific to the .Va type and are not guaranteed to be globally unique. .Pp For all types: .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_SMARTY Don't use smart typography formatting. .It Dv LOWDOWN_STANDALONE Emit a full document instead of a document fragment. This envelope is largely populated from metadata if .Dv LOWDOWN_METADATA was provided as an option or as given in .Va meta or .Va metaovr . .El .Pp For .Dv LOWDOWN_HTML : .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_HTML_CALLOUT_MDN , LOWDOWN_HTML_CALLOUT_GFM Output MDN and/or GFM-style callout syntax. .It Dv LOWDOWN_HTML_ESCAPE If .Dv LOWDOWN_HTML_SKIP_HTML has not been set, escapes in-document HTML so that it is rendered as opaque text. .It Dv LOWDOWN_HTML_HARD_WRAP Retain line-breaks within paragraphs. .It Dv LOWDOWN_HTML_HEAD_IDS Have an identifier written with each header element consisting of an HTML-escaped version of the header contents. .It Dv LOWDOWN_HTML_NUM_ENT Convert, when possible, HTML entities to their numeric form. If not set, the entities are used as given in the input. .It Dv LOWDOWN_HTML_OWASP When escaping text, be extra paranoid in following the OWASP suggestions for which characters to escape. .It Dv LOWDOWN_HTML_SKIP_HTML Do not render in-document HTML at all. .It Dv LOWDOWN_HTML_TITLEBLOCK If used with .Dv LOWDOWN_STANDALONE , output a Pandoc-style title block. This is a .Li
element right after the opening .Li containing elements for specified title, author(s), and date. These are .Li

and .Li

elements, respectively, with classes set to what's being output (title, etc.). At least one of these must be specified for the title block to be output. .El .Pp For .Dv LOWDOWN_GEMINI , there are several flags for controlling link placement. By default, links (images, autolinks, and links) are queued when specified in-line then emitted in a block sequence after the nearest block node. (See .Sx ABSTRACT SYNTAX TREE . ) .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_GEMINI_LINK_END Emit the queue of links at the end of the document instead of after the nearest block node. .It Dv LOWDOWN_GEMINI_LINK_IN Render all links within the flow of text. This will cause breakage when nested links, such as images within links, links in blockquotes, etc. It should not be used unless in carefully crafted documents. .It Dv LOWDOWN_GEMINI_LINK_NOREF Do not format link labels. Takes precedence over .Dv LOWDOWN_GEMINI_LINK_ROMAN . .It Dv LOWDOWN_GEMINI_LINK_ROMAN When formatting link labels, use lower-case Roman numerals instead of the default lowercase hexavigesimal (i.e., .Dq a , .Dq b , \&..., .Dq aa , .Dq ab , \&...). .It Dv LOWDOWN_GEMINI_METADATA Print metadata as the canonicalised key followed by a colon then the value, each on one line (newlines replaced by spaces). The metadata block is terminated by a double newline. If there is no metadata, this does nothing. .El .Pp There may only be one of .Dv LOWDOWN_GEMINI_LINK_END or .Dv LOWDOWN_GEMINI_LINK_IN . If both are specified, the latter is unset. .Pp For .Dv LOWDOWN_FODT : .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_ODT_SKIP_HTML Do not render in-document HTML at all. Text within HTML elements remains. .El .Pp For .Dv LOWDOWN_LATEX : .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_LATEX_NUMBERED Use the default numbering scheme for sections, subsections, etc. If not specified, these are inhibited. .It Dv LOWDOWN_LATEX_SKIP_HTML Do not render in-document HTML at all. Text within HTML elements remains. .El .Pp For .Dv LOWDOWN_MAN and .Dv LOWDOWN_NROFF : .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_NROFF_GROFF Use GNU extensions (i.e., for .Xr groff 1 ) when rendering output. The groff arguments must include .Fl m Ns Ar pdfmark for formatting links with .Dv LOWDOWN_MAN or .Fl m Ns Ar spdf instead of .Fl m Ns Ar s for .Dv LOWDOWN_NROFF . Applies to the .Dv LOWDOWN_MAN and .Dv LOWDOWN_NROFF output types. .It Dv LOWDOWN_NROFF_NOLINK Don't show links at all if they have embedded text. Applies to images and regular links. Only in .Dv LOWDOWN_MAN or when .Dv LOWDOWN_NROFF_GROFF is not specified. .It Dv LOWDOWN_NROFF_NUMBERED Use numbered sections if .Dv LOWDOWON_NROFF_GROFF is not specified. Only applies to the .Dv LOWDOWN_NROFF output type. .It Dv LOWDOWN_NROFF_SHORTLINK Render link URLs in short form. Applies to images, autolinks, and regular links. Only in .Dv LOWDOWN_MAN or when .Dv LOWDOWN_NROFF_GROFF is not specified. .It Dv LOWDOWN_NROFF_SKIP_HTML Do not render in-document HTML at all. Text within HTML elements remains. .El .Pp For .Dv LOWDOWN_TERM : .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_TERM_ALL_META If .Dv LOWDOWN_STANDALONE is specified, output all metadata instead of just the title, author, and date. .It Dv LOWDOWN_TERM_NOANSI Don't apply ANSI style codes at all. This implies .Dv LOWDOWN_TERM_NOCOLOUR . .It Dv LOWDOWN_TERM_NOCOLOUR Don't apply ANSI colour codes. This will still show underline, bold, etc. This should not be used in difference mode, as the output will make no sense. .It Dv LOWDOWN_TERM_NOLINK Don't show links at all. Applies to images and regular links: autolinks are still shown. This may be combined with .Dv LOWDOWN_TERM_SHORTLINK to also shorten autolinks. .It Dv LOWDOWN_TERM_SHORTLINK Render link URLs in short form. Applies to images, autolinks, and regular links. This may be combined with .Dv LOWDOWN_TERM_NOLINK to only show shortened autolinks. .El .It Va size_t maxdepth The maximum parse depth before the parser exits. Most documents will have a parse depth in the single digits. .It Va size_t cols For .Dv LOWDOWN_TERM , the .Dq soft limit for width of terminal output not including margins. If zero, 80 shall be used. .It Va size_t hmargin For .Dv LOWDOWN_TERM , the left margin (space characters). .It Va size_t vmargin For .Dv LOWDOWN_TERM , the top/bottom margin (newlines). .It Va struct lowdown_opts_nroff nroff If .Va type is .Dv LOWDOWN_MAN or .Dv LOWDOWN_NROFF , this contains constant-width font variants: .Vt "const char *cr" for roman constant-width, .Vt "const char *cb" for bold, .Vt "const char *ci" for italic, and .Vt "const char *cbi" for bold-italic. If any of these are .Dv NULL , they default to their constant-width variants. .It Va struct lowdown_opts_odt odt If .Va type is .Dv LOWDOWN_FODT , this contains .Vt "const char *sty" , which is either .Dv NULL or the OpenDocument styles used when creating standalone documents. If .Dv NULL , the default styles are used. .It Va char **meta An array of metadata key-value pairs or .Dv NULL . Each pair must appear as if provided on one line (or multiple lines) of the input, including the terminating newline character. If not consisting of a valid pair (e.g., no newline, no colon), then it is ignored. When processed, these values are overridden by those in the document (if .Dv LOWDOWN_METADATA is specified) or by those in .Va metaovr . .It Va size_t metasz Number of pairs in .Va metaovr . .It Va char **metaovr See .Va meta . The difference is that .Va metaovr is applied after .Va meta and in-document metadata, so it overrides prior values. .It Va size_t metaovrsz Number of pairs in .Va metaovr . .El .Pp Parsed metadata is held in key-value .Vt "struct lowdown_meta" pairs, or collectively as .Va "struct lowdown_metaq" , if .Dv LOWDOWN_METADATA is set in .Va feat . The former structure consists of the following fields: .Bl -tag -width Ds .It Va char *key The metadata key in its canonical form: lowercase alphanumerics, hyphen, and underscore. Whitespace is removed and other characters replaced by a question mark. .It Va char *value The metadata value. This may be an empty string. .El .Pp The abstract syntax tree is encoded in .Vt struct lowdown_node , which consists of the following. .Bl -tag -width Ds .It Va enum lowdown_rndrt type The node type, using HTML5 output as an illustration: .Pp .Bl -tag -width Ds -compact .It Dv LOWDOWN_BLOCKCODE A block-level snippet of code described by .Li

 .
.It Dv LOWDOWN_BLOCKHTML
A block-level snippet of HTML.
This is simply opaque HTML content.
.It Dv LOWDOWN_BLOCKQUOTE
A block-level quotation described by
.Li 
. .It Dv LOWDOWN_CODESPAN An inline-level snippet of code described by .Li . .It Dv LOWDOWN_DEFINITION A definition list described by .Li
. .It Dv LOWDOWN_DEFINITION_DATA Definition data described by .Li
. .It Dv LOWDOWN_DEFINITION_TITLE Definition title described by .Li
. .It Dv LOWDOWN_DOC_HEADER Container for metadata described by .Li . .It Dv LOWDOWN_DOUBLE_EMPHASIS Bold (or otherwise notable) content described by .Li . .It Dv LOWDOWN_EMPHASIS Italic (or otherwise notable) content described by .Li . .It Dv LOWDOWN_ENTITY Named or numeric HTML entity. .It Dv LOWDOWN_FOOTNOTE Footnote content. .It Dv LOWDOWN_HEADER A block-level header described by one of .Li

through .Li

. .It Dv LOWDOWN_HIGHLIGHT Marked test described by .Li . .It Dv LOWDOWN_HRULE A horizontal line described by .Li
. .It Dv LOWDOWN_IMAGE An image described by .Li . .It Dv LOWDOWN_LINEBREAK A hard line-break within a block context described by .Li
. .It Dv LOWDOWN_LINK A link to external media described by .Li . .It Dv LOWDOWN_LINK_AUTO Like .Dv LOWDOWN_LINK , except inferred from text content. .It Dv LOWDOWN_LIST A list enclosure described by .Li
    or .Li
      . .It Dv LOWDOWN_LISTITEM A list item described by .Li
    1. . .It Dv LOWDOWN_MATH_BLOCK A snippet of mathematical text in LaTeX format described within .Li \e[xx\e] or .Li \e(xx\e) . This is usually (in HTML) externally handled by a JavaScript renderer. .It Dv LOWDOWN_META Meta-data keys and values. These are described by elements in .Li . .It Dv LOWDOWN_NORMAL_TEXT Normal text content. .It Dv LOWDOWN_PARAGRAPH A block-level paragraph described by .Li

      . .It Dv LOWDOWN_RAW_HTML An inline of raw HTML. (Only if configured during parse.) .It Dv LOWDOWN_ROOT The root of the document. This is always the topmost node, and the only node where the .Va parent field is .Dv NULL . .It Dv LOWDOWN_STRIKETHROUGH Content struck through. Described by .Li . .It Dv LOWDOWN_SUBSCRIPT , Dv LOWDOWN_SUPERSCRIPT A subscript or superscript described by .Li or .Li , respectively. .It Dv LOWDOWN_TABLE_BLOCK A table block described by .Li . .It Dv LOWDOWN_TABLE_BODY A table body section described by .Li . .It Dv LOWDOWN_TABLE_CELL A table cell described by .Li . .It Dv LOWDOWN_TABLE_ROW A table row described by .Li . .It Dv LOWDOWN_TRIPLE_EMPHASIS Combination of .Dv LOWDOWN_EMPHASIS and .Dv LOWDOWN_DOUBLE_EMPHASIS . .El .It Va size_t id An identifier unique within the document. This can be used as a table index since the number is assigned from a monotonically increasing point during the parse. .It Va struct lowdown_node *parent The parent of the node, or .Dv NULL at the root. .It Va enum lowdown_chng chng Change tracking: whether this node was inserted .Pq Dv LOWDOWN_CHNG_INSERT , deleted .Pq Dv LOWDOWN_CHNG_DELETE , or neither .Pq Dv LOWDOWN_CHNG_NONE . .It Va struct lowdown_nodeq children A possibly-empty list of child nodes. .It Va An anonymous union of type-specific structures. .Pp .Bl -tag -width Ds -compact .It Va rndr_autolink For .Dv LOWDOWN_LINK_AUTO , the link address as .Va link and the link type .Va type , which may be one of .Dv HALINK_EMAIL for e-mail links and .Dv HALINK_NORMAL otherwise. Any buffer may be empty-sized. .It Va rndr_blockcode For .Dv LOWDOWN_BLOCKCODE , the opaque .Va text of the block and the optional .Va lang of the code language. .It Va rndr_blockhtml For .Dv LOWDOWN_BLOCKHTML , the opaque HTML .Va text . .It Va rndr_codespan The opaque .Va text of the contents. .It Va rndr_definition For .Dv LOWDOWN_DEFINITION , containing .Va flags that may be .Dv HLIST_FL_BLOCK if the definition list should be interpreted as containing block nodes. .It Va rndr_entity For .Dv LOWDOWN_ENTITY , the entity .Va text . .It Va rndr_header For .Dv LOWDOWN_HEADER , the .Va level of the header starting at zero (this value is relative to the metadata base header level, defaulting to one), optional space-separated class list .Va attr_cls , and optional single identifier .Va attr_id . .It Va rndr_image For .Dv LOWDOWN_IMAGE , the image address .Va link , the image title .Va title , dimensions NxN (width by height) in .Va dims , and alternate text .Va alt . CSS in-line style for width and height may be given in .Va attr_width and/or .Va attr_height , and a space-separated list of classes may be in .Va attr_cls and a single identifier may be in .Va attr_id . .It Va rndr_link Like .Va rndr_autolink , but without a type and further defining an optional link title .Va title , optional space-separated class list .Va attr_cls , and optional single identifier .Va attr_id . .It Va rndr_list For .Dv LOWDOWN_LIST , consists of a bitfield .Va flags that may be set to .Dv HLIST_FL_ORDERED for an ordered list and .Dv HLIST_FL_UNORDERED for an unordered one. If .Dv HLIST_FL_BLOCK is set, the list should be output as if items were separate blocks. The .Va start value for .Dv HLIST_FL_ORDERED is the starting list item position, which is one by default and never zero. The .Va items is the number of list items. .It Va rndr_listitem For .Dv LOWDOWN_LISTITEM , consists of a bitfield .Va flags that may be set to .Dv HLIST_FL_ORDERED for an ordered list, .Dv HLIST_FL_UNORDERED for an unordered list, .Dv HLIST_FL_DEF for definition list data, .Dv HLIST_FL_CHECKED or .Dv HLIST_FL_UNCHECKED for an unordered .Dq task list, and/or .Dv HLIST_FL_BLOCK for list item output as if containing block nodes. The .Dv HLIST_FL_BLOCK should not be used: use the parent list (or definition list) flags for this. The .Va num is the index in a .Dv HLIST_FL_ORDERED list. It is monotonically increasing with each item in the list, starting at the .Va start variable given in .Vt struct rndr_list . .It Va rndr_math For .Dv LOWDOWN_MATH , the mode of display in .Va blockmode : if 1, in-line math; if 2, multi-line. The opaque equation, which is assumed to be in LaTeX format, is in the opaque .Va text . .It Va rndr_meta Each .Dv LOWDOWN_META key-value pair is represented. The keys are lower-case without spaces or non-ASCII characters. If provided, enclosed nodes may consist only of .Dv LOWDOWN_NORMAL_TEXT and .Dv LOWDOWN_ENTITY . .It Va rndr_normal_text The basic .Va text content for .Dv LOWDOWN_NORMAL_TEXT . If .Va flags is set to .Dv HTEXT_ESCAPED , the text may be escaped for output, but may not be altered by any smart typography or similar (it should be passed as-is). .It Va rndr_paragraph For .Dv LOWDOWN_PARAGRAPH , species how many .Va lines the paragraph has in the input file and .Va beoln , set to non-zero if the paragraph ends with an empty line instead of a breaking block node. .It Va rndr_raw_html For .Dv LOWDOWN_RAW_HTML , the opaque HTML .Va text . .It Va rndr_table For .Dv LOWDOWN_TABLE_BLOCK , the number of .Va columns in each row or header row. The number of columns in .Va rndr_table , .Va rndr_table_header , and .Va rndr_table_cell are the same. .It Va rndr_table_cell For .Dv LOWDOWN_TABLE_CELL , the current .Va col column number out of .Va columns . See .Va rndr_table_header for a description of the bits in .Va flags . The number of columns in .Va rndr_table , .Va rndr_table_header , and .Va rndr_table_cell are the same. .It Va rndr_table_header For .Dv LOWDOWN_TABLE_HEADER , the number of .Va columns in each row and the per-column .Va flags , which may tested for equality against .Dv HTBL_FL_ALIGN_LEFT , .Dv HTBL_FL_ALIGN_RIGHT , or .Dv HTBL_FL_ALIGN_CENTER after being masked with .Dv HTBL_FL_ALIGNMASK ; or .Dv HTBL_FL_HEADER . If no alignment is specified after the mask, the default should be left-aligned. The number of columns in .Va rndr_table , .Va rndr_table_header , and .Va rndr_table_cell are the same. .El .El .Sh ABSTRACT SYNTAX TREE A parsed document is a tree of .Vt struct lowdown_node nodes. If a node is .Dq block , it may contain other block or inline nodes. If .Dq inline, it may only contain other inline nodes. .Dq Special nodes are documented below. An additional mark of .Dq void means that the node will never contain children. .Pp .Bl -column "LOWDOWN_DEFINITION_TITLE" "special, void" -offset indent -compact .It Node Ta Scope .It Dv LOWDOWN_BLOCKCODE Ta block, void .It Dv LOWDOWN_BLOCKHTML Ta block, void .It Dv LOWDOWN_BLOCKQUOTE Ta block .It Dv LOWDOWN_CODESPAN Ta inline, void .It Dv LOWDOWN_DEFINITION Ta block .It Dv LOWDOWN_DEFINITION_DATA Ta special .It Dv LOWDOWN_DEFINITION_TITLE Ta special .It Dv LOWDOWN_DOC_HEADER Ta special .It Dv LOWDOWN_DOUBLE_EMPHASIS Ta inline .It Dv LOWDOWN_EMPHASIS Ta inline .It Dv LOWDOWN_ENTITY Ta inline, void .It Dv LOWDOWN_FOOTNOTE Ta block, special .It Dv LOWDOWN_HEADER Ta block .It Dv LOWDOWN_HRULE Ta inline, void .It Dv LOWDOWN_IMAGE Ta inline, void .It Dv LOWDOWN_LINEBREAK Ta inline, void .It Dv LOWDOWN_LINK Ta inline .It Dv LOWDOWN_LINK_AUTO Ta inline, void .It Dv LOWDOWN_LIST Ta block .It Dv LOWDOWN_LISTITEM Ta special .It Dv LOWDOWN_MATH_BLOCK Ta inline, void .It Dv LOWDOWN_META Ta special .It Dv LOWDOWN_NORMAL_TEXT Ta inline, void .It Dv LOWDOWN_PARAGRAPH Ta block .It Dv LOWDOWN_RAW_HTML Ta inline, void .It Dv LOWDOWN_ROOT Ta special .It Dv LOWDOWN_STRIKETHROUGH Ta inline .It Dv LOWDOWN_SUBSCRIPT Ta inline .It Dv LOWDOWN_SUPERSCRIPT Ta inline .It Dv LOWDOWN_TABLE_BLOCK Ta block .It Dv LOWDOWN_TABLE_BODY Ta special .It Dv LOWDOWN_TABLE_CELL Ta special .It Dv LOWDOWN_TABLE_HEADER Ta special .It Dv LOWDOWN_TABLE_ROW Ta special .It Dv LOWDOWN_TRIPLE_EMPHASIS Ta inline .El .Pp The general structure of the AST is as follows. Nodes have no order imposed on them unless as noted: .Pp .Bl -dash -compact .It .Dv LOWDOWN_ROOT .Pq ordered .Bl -dash -compact .It .Dv LOWDOWN_DOC_HEADER .Bl -dash -compact .It .Dv LOWDOWN_META .Bl -dash -compact .It .Dv LOWDOWN_ENTITY .It .Dv LOWDOWN_NORMAL_TEXT .El .El .It .Pq zero or more block nodes .El .El .Pp Special nodes have specific placement within their parents as follows: .Bl -dash .It .Dv LOWDOWN_DEFINITION .Pq one or more ordered pairs of... .Bl -dash -compact .It .Dv LOWDOWN_DEFINITION_TITLE .Bl -dash -compact .It .Pq inline nodes .El .It .Dv LOWDOWN_DEFINITION_DATA .Bl -dash -compact .It .Pq block nodes .El .El .It .Dv LOWDOWN_HEADER .Bl -dash -compact .It .Pq inline nodes .El .It .Dv LOWDOWN_LIST .Bl -dash -compact .It .Dv LOWDOWN_LISTITEM .Bl -dash -compact .It .Pq inline or block nodes, depending .El .El .It .Dv LOWDOWN_TABLE_BLOCK .Pq ordered .Bl -dash -compact .It .Dv LOWDOWN_TABLE_HEADER .Pq zero or more... .Bl -dash -compact .It .Dv LOWDOWN_TABLE_ROW .Pq one or more... .Bl -dash -compact .It .Dv LOWDOWN_TABLE_CELL .Bl -dash -compact .It .Pq inline nodes .El .El .El .It .Dv LOWDOWN_TABLE_BODY .Pq zero or more... .Bl -dash -compact .It .Dv LOWDOWN_TABLE_ROW .Pq one or more... .Bl -dash -compact .It .Dv LOWDOWN_TABLE_CELL .Bl -dash -compact .It .Pq inline nodes .El .El .El .El .El .Pp Lastly, .Dv LOWDOWN_FOOTNOTE may appear anywhere in the document and contains block nodes. .Sh SEE ALSO .Xr lowdown 1 , .Xr lowdown_buf 3 , .Xr lowdown_buf_diff 3 , .Xr lowdown_diff 3 , .Xr lowdown_doc_free 3 , .Xr lowdown_doc_new 3 , .Xr lowdown_doc_parse 3 , .Xr lowdown_file 3 , .Xr lowdown_file_diff 3 , .Xr lowdown_gemini_free 3 , .Xr lowdown_gemini_new 3 , .Xr lowdown_gemini_rndr 3 , .Xr lowdown_html_free 3 , .Xr lowdown_html_new 3 , .Xr lowdown_html_rndr 3 , .Xr lowdown_latex_free 3 , .Xr lowdown_latex_new 3 , .Xr lowdown_latex_rndr 3 , .Xr lowdown_metaq_free 3 , .Xr lowdown_nroff_free 3 , .Xr lowdown_nroff_new 3 , .Xr lowdown_nroff_rndr 3 , .Xr lowdown_odt_free 3 , .Xr lowdown_odt_new 3 , .Xr lowdown_odt_rndr 3 , .Xr lowdown_term_free 3 , .Xr lowdown_term_new 3 , .Xr lowdown_term_rndr 3 , .Xr lowdown_tree_rndr 3 , .Xr lowdown 5 .Sh AUTHORS .Nm lowdown was forked from .Lk https://github.com/hoedown/hoedown hoedown by .An Kristaps Dzonsons , .Mt kristaps@bsd.lv . It has been considerably modified since.
      , or .Li if in the header. .It Dv LOWDOWN_TABLE_HEADER A table header section described by .Li