lus_body_escape(3) various markdown to HTML renderers for soldout

Other Alias

soldout_renderers, lus_attr_escape

SYNOPSIS

In renderers.h Ft void Fo lus_attr_escape Fa struct buf *ob Fa const char *str Fa size_t len Fc Ft void Fo lus_body_escape Fa struct buf *ob Fa const char *str Fa size_t len Fc Vt extern const struct mkd_renderer mkd_html; Vt extern const struct mkd_renderer mkd_xhtml; Vt extern const struct mkd_renderer discount_html; Vt extern const struct mkd_renderer discount_xhtml; Vt extern const struct mkd_renderer nat_html; Vt extern const struct mkd_renderer nat_xhtml;

DESCRIPTION

The Fn lus_attr_escape and Fn lus_body_escape functions escape all problematic characters in (X)HTML: `<' , `>' , `&' , `"' ; and `<' , `>' , `&' respectively. They accept a string str of the length len and output into ob buffer.

All provided renderers come with two flavors, _html producing HTML code (self-closing tags are rendered like this: <hr>), and _xhtml producing XHTML code (self-closing tags like <hr />).

mkd_html and mkd_xhtml implement standard markdown to (X)HTML translation without any extension.

discount_html and discount_xhtml implement on top of the standard markdown some of the extensions found in Discount and PHP-Markdown-like tables. Here is a list of all extensions included in these renderers:

  • image size specification, by appending "=(width)x(height)" to the link
  • pseudo-protocols in links:

    • abbr:description for <abbr title="description">...</abbr>
    • class:name for <span class="name">...</span>
    • id:name for <span id="name">...</span>
    • raw:text for verbatim unprocessed text inclusion

  • class blocks: blockquotes beginning with %class% will be rendered as a div of the given class(es)

nat_html and nat_xhtml implement on top of Discount extensions and Natasha's own extensions. Here is a list of these extensions:

  • id attribute for headers, using the syntax id#Header text
  • class attribute for paragraphs, by putting class name(s) between parenthesis at the very beginning of the paragraph
  • <ins> and <del> spans, using respectively ++ and -- as delimiters (with emphasis-like restrictions, i.e. an opening delimiter cannot be followed by a whitespace, and a closing delimiter cannot be preceded by a whitespace)
  • plain <span> without attribute, using emphasis-like delimiter |

RETURN VALUES

The Fn lus_attr_escape and Fn lus_body_escape functions do not return a value.

AUTHORS

An -nosplit The soldout library was written by An Natasha Qo Kerensikova Qc Porte Aq Mt [email protected] . Manual page was originally written by An Massimo Manghi Aq Mt [email protected] , and rewritten to mdoc format by An Svyatoslav Mishyn Aq Mt [email protected] .