adoc

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

README

= 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"

  "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>
}
----

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAsciiDocFormatter added in v0.1.0

func NewAsciiDocFormatter() *formatter.AsciiDoc

func NewDocument added in v0.1.0

func NewDocument() *document.Document

func NewHTMLFormatter added in v0.1.0

func NewHTMLFormatter() *formatter.HTML

func NewParser

func NewParser(reader io.Reader) *parser.Parser

func NewTextFormatter added in v0.1.0

func NewTextFormatter() *formatter.Text

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL