htmltotext

package module
v0.0.0-...-6a8de9c Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 6 Imported by: 0

README

Build Status codecov GoDoc

Convert HTML to plain text.

Documentation

Overview

Package htmltotext converts HTML to plain text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToDocument

func ToDocument(html string) string

ToDocument removes HTML tags from a document and attempts to format it so it's relatively readable.

func ToLine

func ToLine(html string) string

ToLine behaves line ToText, but also collapses all newlines to a single space, so the resulting text is always a single line.

func ToText

func ToText(html string) string

ToText removes HTML tags. In general you only want to use this for short strings (e.g. a line or less). use ToDocument() for longer text with paragraphs.

For example:

<b>&iexcl;Hi!</b> <script>...</script>

becomes:

&iexcl;Hi!

Types

This section is empty.

Jump to

Keyboard shortcuts

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