all repos — rel2abs @ dce15cb59ed63defbcef744d34a5e18a83ac1824

go library to convert all relative urls in a html document to absolute ones

Init readme
Anirudh Oppiliappan x@icyphox.sh
Wed, 29 Sep 2021 22:00:55 +0530
commit

dce15cb59ed63defbcef744d34a5e18a83ac1824

parent

2fcd126dea001db07fde887da91745586af517e9

1 files changed, 22 insertions(+), 0 deletions(-)

jump to
A readme

@@ -0,0 +1,22 @@

+rel2abs +------- + +Go library to convert all relative URLs to absolute ones, resolved +against a specified base URL. + + +EXAMPLE + + import ( + "fmt" + + "git.icyphox.sh/rel2abs" + ) + + func main() { + htmlRel := `<html><body><a href="#footnote-1">[1]</a></body></html>` + htmlAbs, err := rel2abs.Rel2Abs([]byte(htmlRel), "http://foo.com/bar") + + fmt.Println(htmlAbs) + // <html><body><a href="http://foo.com/bar#footnote-1">[1]</a></body></html> + }