soldout_renderers(3)

soldout_renderers3

Various markdown to html renderers for soldout

Usage

#include <renderers.h>

void

lus_attr_escape(struct buf *ob, const char *str, size_t len);

void

lus_body_escape(struct buf *ob, const char *str, size_t len);

extern const struct mkd_renderer mkd_html; extern const struct mkd_renderer mkd_xhtml; extern const struct mkd_renderer discount_html; extern const struct mkd_renderer discount_xhtml; extern const struct mkd_renderer nat_html; extern const struct mkd_renderer nat_xhtml;

Overview

The lus_attr_escape() and 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 lus_attr_escape() and lus_body_escape() functions do not return a value.

Releases

Unchanged in 5 releases since Debian 9 (Stretch).

  1. 9–13

Authors

The soldout library was written by Natasha "Kerensikova" Porte ⟨[email protected]⟩. Manual page was originally written by Massimo Manghi ⟨[email protected]⟩, and rewritten to mdoc format by Svyatoslav Mishyn ⟨[email protected]⟩.

From libsoldout-dev 1.4-7+b1 in Debian 13 (Trixie). Parsed by carta from the page's mdoc source.