Packages of reStructuredText (to HTML ) implementation in Golang . After some
googling, I found and , it seems only provides rst-to-HTML
conversion, so I tried only.
Install the package:
$ go get -u github.com/hhatto/gorst
Test Code
Test program:
hhatto.go |
repository |
view raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package main
import (
"bufio"
"bytes"
"github.com/hhatto/gorst"
"io/ioutil"
"os"
)
func main () {
p := rst . NewParser ( nil )
w := bufio . NewWriter ( os . Stdout )
d , _ := ioutil . ReadFile ( "test.rst" )
p . ReStructuredText ( bytes . NewReader ( d ), rst . ToHTML ( w ))
w . Flush ()
}
Test rst file:
test.rst |
repository |
view raw
1
2
3
4
5
6
7
8
9
10
11
12 `my blog <https://siongui.github.io> `_
----
*italic*
**bold**
``hello``
Heading
=======
Output of Test Code
<p><a href="https://siongui.github.io">my blog </a></p>
<hr />
<p><em>italic</em></p>
<p><strong>bold</strong></p>
<p><code>hello</code></p>
<h2>Heading</h2>
Tested on: Ubuntu Linux 15.10 , Go 1.5.3 .
References: