package tyxml

  1. Overview
  2. Docs
TyXML is a library for building statically correct HTML5 and SVG documents

Install

Dune Dependency

Authors

Maintainers

Sources

4.2.0.tar.gz
sha256=cda9dda443d479fadd1f4b8f882aef2a78c6e7ca7cbc95d886dfc5743f86ff9a
md5=c802f3c7036adcea3fc00398c23d1b2b

doc/tyxml.functor/Xml_print/Utf8/index.html

Module Xml_print.Utf8

Utf8 normalizer and encoder for HTML.

Given a module pp functions produced by one of the functors in Xml_print, this modules is used as following:

  let encode x = fst (Xml_print.Utf8.normalize_html x) in
  Format.printf "%a" (Html.pp ~encode ()) document
type utf8 = string
val normalize : string -> utf8 * bool

normalize str take a possibly invalid utf-8 string and return a valid utf-8 string where invalid bytes have been replaced by the replacement character U+FFFD. The returned boolean is true if invalid bytes were found

val normalize_html : string -> utf8 * bool

Same as normalize plus some extra work : It encode '<' , '>' , '"' , '&' characters with corresponding entities and replaced invalid html character by U+FFFD

OCaml

Innovation. Community. Security.