Some common utilities

Functions

f
date_to_string(date: string): string

Convert an ISO formatted date to a more readable format.

f
de_xml(inp: string): string

Remove any XML/HTML tags from the input; <br/> tags are replaced by space and all other tags are removed.

f
remove_entities(inp: string): string

Filter XML entities in an xhtml code, and turn them into their equivalent hexadecimal Unicode point

f
slice_text(inp: string): string

“Slice” a long text into lines separated by the (HTML) <br/> tag. Used as a rudimentary tool when adding the title lines to an SVG content.

f
to_xhtml(dom: jsdom.JSDOM | string): string

Convert an HTML5 content (in text or as a DOM) into XHTML5.