Documentation
¶
Overview ¶
Package article contains the bounded, text-only rendering used by article extraction. It deliberately accepts a DOM instead of an HTML string so the extractor does not need to serialize and parse its result again.
Index ¶
Constants ¶
const ( // MaxMarkdownDepth is separate from readability's element limit. A deeply // nested, otherwise small document must not consume an unbounded Go stack. MaxMarkdownDepth = core.MaxNestingDepth )
Variables ¶
var ( // ErrNilNode reports an invalid conversion root. ErrNilNode = errors.New("article markdown: nil HTML node") // ErrMarkdownTooLarge reports output that cannot be retained safely. ErrMarkdownTooLarge = errors.New("article markdown: rendered output exceeds the size limit") )
var ErrUnsupportedContentType = errors.New("article mode requires HTML or Markdown content")
ErrUnsupportedContentType identifies a response that article mode cannot extract. Article mode accepts HTML/XHTML and Markdown responses.
Functions ¶
func Convert ¶
Convert renders root and its descendants as deterministic CommonMark-style Markdown. root may be a document node or any content node. The result has a single trailing newline when it contains content.
The renderer is intentionally conservative. It omits executable and presentation-only elements, treats unknown elements according to their block/inline role, and skips descendants beyond MaxMarkdownDepth.
func ReadLimited ¶
ReadLimited reads at most the configured decoded article-body limit. It does not retain a sentinel byte when the input is exactly at the limit.
Types ¶
This section is empty.