readme with example

This commit is contained in:
Erik Winter 2022-04-06 06:26:42 +02:00
parent 04244d682a
commit 49ac666c00
2 changed files with 52 additions and 1 deletions

52
README.adoc Normal file
View File

@ -0,0 +1,52 @@
= AsciiDoc parser
A limited parser for the https://asciidoc-py.github.io/index.html[Asciidoc] markup language.
== Example
----
package main
import (
"fmt"
"strings"
"ewintr.nl/adoc/format"
"ewintr.nl/adoc/parser"
)
func main() {
sourceDoc := `= This is the title
And this is the first paragraph. With some text. Lists are supported too:
* Item 1
* Item 2
* Item 3
And we also have things like *bold* and _italic_.`
par := parser.New(strings.NewReader(sourceDoc))
doc := par.Parse()
htmlDoc := format.HTML(doc)
fmt.Println(htmlDoc)
// output:
//
// <!DOCTYPE html>
// <html>
// <head>
// <title>This is the title</title>
// </head>
// <body>
// <p>And this is the first paragraph. With some text. Lists are supported too:</p>
// <ul>
// <li>Item 1</li>
// <li>Item 2</li>
// <li>Item 3</li>
// </ul>
// <p>And we also have things like <strong>bold</strong> and <em>italic</em>.</p>
// </html>
}
----

View File

@ -1 +0,0 @@
= AsciiDoc parser