Package htmlimg provides tool for working with the HTML element, for the Go programming language.
Find a file
2025-09-08 04:01:40 -07:00
go.mod go.* 2025-09-07 10:16:29 -07:00
LICENSE initial commit 2025-09-07 09:56:18 -07:00
README.md docs 2025-09-08 04:01:40 -07:00
replaceallwithalt.go htmlimg.ReplaceAllWithAlt() 2025-09-07 10:30:19 -07:00
replaceallwithalt_test.go tests 2025-09-07 10:30:39 -07:00

go-htmlimg

Package htmlimg provides tool for working with the HTML <img> element, for the Go programming language.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-htmlimg

GoDoc

Example

Here is an example replacing all the HTML <img> elements with its alt text:

import "codeberg.org/reiver/go-htmlimg"

// ...

var html string = `<h1>Hello <img src="planet.png" alt="World" /></h1>`

replaced := htmlimg.ReplaceAllWithAlt(html)
// replaced == "<h1>Hello World</h1>"

Import

To import package htmlimg use import code like the following:

import "codeberg.org/reiver/go-htmlimg"

Installation

To install package htmlimg do the following:

GOPROXY=direct go get codeberg.org/reiver/go-htmlimg

Author

Package htmlimg was written by Charles Iliya Krempeaux