unhtml

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 5 Imported by: 0

README

UNHTML

Go Reference

Package unhtml is designed to remove HTML tags from text and do minor formatting updates. It is intended to avoid changing the text very much - in particular so that it doesn't mess up formatted plain text when HTML tags are not present. This allows you to run the converter on data that you received without needing to bother checking if HTML tags are in there.

That said, the package is primarily intended to handle minor HTML snippets. It isn't a full-fledged formatter. Below are tags that are ignored, handled, and intentionally skipped.

Ignored tags:

(comments)
DOCTYPE
abbr
acronym
address
area
article
aside
audio
b
base
basefont
bdi
bdo
big
body
button
canvas
caption
center
cite
code
col
colgroup
datalist
dd
del
details
dfn
dialog
dir
dl
dt
em
fieldset
figcaption
figure
font
footer
form
header
html
i
input
ins
kbd
keygen
label
legend
main
map
mark
menu
menuitem
meter
nav
noframes
noscript
optgroup
option
output
param
progress
q
rp
rt
ruby
s
samp
section
select
small
source
span
strike
strong
sub
summary
sub
summary
sup
tbody
textarea
tfoot
thead
time
track
tt
u
var
video
wbr

Skipped tags:

applet
embed
frame
frameset
head
iframe
link
meta
object
script
style
title

Handled tags:

a
blockquote
br
div
h1 to h6
hr
img
li
ol
p
pre
table
td
th
tr

Documentation

Overview

Package unhtml is designed to remove HTML tags from text and do minor formatting updates. It is intended to avoid changing the text very much - in particular so that it doesn't mess up formatted plain text when HTML tags are not present. This allows you to run the converter on data that you received without needing to bother checking if HTML tags are in there.

That said, the package is primarily intended to handle minor HTML snippets. It isn't a full-fledged formatter. Below are tags that are ignored, handled, and intentionally skipped.

Ignored tags:

(comments)
DOCTYPE
abbr
acronym
address
area
article
aside
audio
b
base
basefont
bdi
bdo
big
body
button
canvas
caption
center
cite
code
col
colgroup
datalist
dd
del
details
dfn
dialog
dir
dl
dt
em
fieldset
figcaption
figure
font
footer
form
header
html
i
input
ins
kbd
keygen
label
legend
main
map
mark
menu
menuitem
meter
nav
noframes
noscript
optgroup
option
output
param
progress
q
rp
rt
ruby
s
samp
section
select
small
source
span
strike
strong
sub
summary
sub
summary
sup
tbody
textarea
tfoot
thead
time
track
tt
u
var
video
wbr

Skipped tags:

applet
embed
frame
frameset
head
iframe
link
meta
object
script
style
title

Handled tags:

a
blockquote
br
div
h1 to h6
hr
img
li
ol
p
pre
table
td
th
tr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HtmlToText

func HtmlToText(in io.Reader, out io.Writer) error

HtmlToText converts the HTML in the reader to text in the writer.

func HtmlToTextString

func HtmlToTextString(in string) (string, error)

HtmlToTextString converts a string of HTML into a string of plain text.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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