Go to file
Erik Winter e20b78d450 update domain 2024-09-15 12:07:22 +02:00
doc supported elements doc 2022-12-20 16:04:29 +01:00
document update domain 2024-09-15 12:07:22 +02:00
element update domain 2024-09-15 12:07:22 +02:00
formatter update domain 2024-09-15 12:07:22 +02:00
parser update domain 2024-09-15 12:07:22 +02:00
token update domain 2024-09-15 12:07:22 +02:00
LICENSE.txt start project 2022-03-10 06:09:17 +01:00
README.adoc update domain 2024-09-15 12:07:22 +02:00
adoc.go update domain 2024-09-15 12:07:22 +02:00
go.mod update domain 2024-09-15 12:07:22 +02:00
go.sum update domain 2024-09-15 12:07:22 +02:00

README.adoc

= README.adoc
2022-04-06

The beginnings of a parser for the https://asciidoc-py.github.io/index.html[Asciidoc] markup language.

== Example

https://go.dev/play/p/hF2wn_GdkBK[Run the snippet below on the Go Playground]

----
package main

import (
  "fmt"
  "strings"

  "go-mod.ewintr.nl/adoc"
)

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 := adoc.NewParser(strings.NewReader(sourceDoc))
  doc := par.Parse()

  htmlDoc := adoc.NewHTMLFormatter().Format(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>
}
----