HTML processing
Use InputFormat.HTML to convert an HTML fragment. Tags and attributes remain
in the output; conversion applies to eligible text nodes.
Built-in preservation
<pre>, <code>, <kbd>, <script>, <style> and <textarea> preserve
their contents and descendants. The inherited lang attribute also controls
conversion: Korean language tags (ko or kor, with or without further
subtags such as ko-KR, case-insensitively) permit conversion; other language
tags preserve text. A nested lang can override the inherited language.
Use explicit rules for other preservation conventions such as
translate="no".
Custom preservation
HtmlOptions adds class and attribute rules. If any rule matches an element,
that element and every descendant are preserved.
Class names are case-sensitive tokens separated by ASCII whitespace.
AttributeMatcher(name) checks presence; AttributeMatcher(name, value)
checks the decoded value. Attribute names ignore ASCII case, while values
are case-sensitive. Pass an AttributeMatcher; a bare attribute-name string
is not accepted.
Ruby markup
Combine HTML with RenderMode.RUBY_ON_HANGUL, RUBY_ON_HANJA, or original
mode with OriginalGloss.RUBY to produce ruby annotations. Text-only elements
such as <title> and <option> use parenthetical fallback instead. See
Rendering modes for complete examples.
Error recovery
Recovery.STRICT, the default, raises GukhanmunError when the HTML scanner
encounters malformed input it cannot process. Recovery.LENIENT preserves
the malformed region verbatim and converts the parts it can recognize:
Lenient recovery does not repair or sanitize HTML. It retains the unrecognized region, which can include the rest of an unfinished construct. This option does not affect plain text or Markdown. See the error reference for codes and cause chains.