Skip to content

ewintr/adoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README.adoc

The beginnings of a parser for the Asciidoc markup language.

Currently it supports:

  • headers

  • paragraphs

  • lists

  • links

  • bold

  • italic

  • inline code

  • code blocks

Example

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)

}

This will output the following HTML:

<!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>

About

Minimal hand-built Asciidoc parser

Topics

Resources

License

Stars

Watchers

Forks

Languages