[Golang] HTML to reStructuredText
Introduction
Based on my previous work [7], convert HTML to restructuredtext in Go via net/html package.
The following HTML node/element is supported:
- HTML unordered (bulleted) list (ul li)
- HTML ordered list (ol li)
- HTML link (a)
- HTML image (img)
- HTML thematic break (hr)
- HTML table (table, tbody, tr, td)
- HTML text node
- HTML comment node
Install html2rst Package
$ go get -u github.com/siongui/html2rst
Usage/Example
Tested on: Ubuntu Linux 16.04, Go 1.6.2.
References:
[1] | html - GoDoc |
[2] | goquery - Replace HTML Link Node with reStructuredText Text Node |
[3] | [Golang] Read Lines From File or String |
[4] | go string concat - Google search How to efficiently concatenate strings in Go? - Stack Overflow |
[5] | goquery - Convert HTML Unordered List to reStructuredText |
[6] | [Golang] HTML a, ul, li Element to reStructuredText |
[7] | [Golang] HTML a, img, ul, li Element to reStructuredText |