textutils

package module
v0.1.1 Latest Latest
Warning

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

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

README

textutils

go get gitlab.com/finkoper-lib/textutils

Example:

package main

import (
	"log"
	"gitlab.com/finkoper-lib/textutils"
)

func main() {
	plain, err := textutils.HtmlToPlain("<h1>Heading</h1>\n<p>Lorem ipsum &quot;dolor&#34;.</p>")
	if err != nil {
		log.Fatal(err)
	}
	println(plain)
}

prints:

Heading
Lorem ipsum "dolor".

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HtmlToPlain

func HtmlToPlain(inputHtml string) (string, error)

HtmlToPlain converts an HTML code to machine-readable plain text content

Primary goals are plain text preview, search indexing, etc.

plain, err := HtmlToPlain("<h1>Heading</h1>\n<p>Lorem ipsum &quot;dolor&#34;.</p>")
if err != nil {
	return err
}
println(plain)

prints:

Heading
Lorem ipsum "dolor".

Types

This section is empty.

Jump to

Keyboard shortcuts

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