html2text

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHTMLNode

func FromHTMLNode(doc *html.Node, o ...Options) (string, error)

FromHTMLNode renders text output from a pre-parsed HTML document.

func FromReader

func FromReader(reader io.Reader, options ...Options) (string, error)

FromReader renders text output after parsing HTML for the specified io.Reader.

func FromString

func FromString(input string, options ...Options) (string, error)

FromString parses HTML from the input string, then renders the text form.

Types

type Options

type Options struct {
	PrettyTables        bool                 // Turns on pretty ASCII rendering for table elements.
	PrettyTablesOptions *PrettyTablesOptions // Configures pretty ASCII rendering for table elements.
	OmitLinks           bool                 // Turns on omitting links
	TextOnly            bool                 // Returns only plain text
}

Options provide toggles and overrides to control specific rendering behaviors.

type PrettyTablesOptions

type PrettyTablesOptions struct {
	AutoFormatHeader     bool
	AutoWrapText         bool
	ReflowDuringAutoWrap bool
	ColWidth             int
	ColumnSeparator      string
	RowSeparator         string
	CenterSeparator      string
	HeaderAlignment      int
	FooterAlignment      int
	Alignment            int
	ColumnAlignment      []int
	NewLine              string
	HeaderLine           bool
	RowLine              bool
	AutoMergeCells       bool
	Borders              tablewriter.Border
}

PrettyTablesOptions overrides tablewriter behaviors

func NewPrettyTablesOptions

func NewPrettyTablesOptions() *PrettyTablesOptions

NewPrettyTablesOptions creates PrettyTablesOptions with default settings

Jump to

Keyboard shortcuts

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