htmltext

package
v0.0.0-...-a1c72ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package htmltext converts stored job-description HTML into alternative representations for consumers: plain text and Markdown. Each converter is lenient — a conversion error degrades to returning the input unchanged rather than failing the caller.

This file holds the description sanitizer: HTML processing with no knowledge of boards or postings, shared by packages outside ingest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sanitize

func Sanitize(s string) string

Sanitize returns s with active content, media, and links removed, safe to render directly.

Self-labelled anchors are dropped BEFORE the policy runs: afterwards the unwrapped text can no longer be compared with its destination. The literal-newline repair runs first because it reads the surrounding markup and may emit a <br> the policy must vet.

func ToMarkdown

func ToMarkdown(html string) string

ToMarkdown converts HTML to Markdown, preserving block structure such as lists and headings. On a conversion error it returns the (possibly truncated) input unchanged.

func ToText

func ToText(html string) string

ToText renders HTML as plain text with tags removed. On a conversion error it returns the (possibly truncated) input unchanged.

func ToTextFull

func ToTextFull(input string) string

ToTextFull extracts the complete visible text for derivation, without wrapping, emphasis markers, truncation or caching. Text-node content is preserved and block elements add line boundaries. Plain text keeps its original line boundaries; on a parse error it returns the full input unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址