/org-golang

Convert org-mode to html by golang

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

org-golang

convert org-mode to html

https://img.shields.io/badge/org-syntax-brightgreen.svg https://img.shields.io/badge/license-BSD-blue.svg

How to use?

go get -u github.com/honmaple/org-golang
package main

import (
    "fmt"
    "strings"

    "github.com/honmaple/org-golang"
    "github.com/honmaple/org-golang/render"
)

func main() {
    text := `
* heading
    /italic/ italic/ /italic\/ \/italic\/ \/italic/
    =code= code= =code\= \=code\= \=code=
    ~code1~ code1~ ~code1\~ \~code1\~ \~code~
    s *sss* ss
    exam

    - list1
    sssss
    - list4
        cccc
    - list2
    - title3
    vvvvc

** heading2

    | kk  | kv   |
    |-----+------|
    | sss | cccc |
    |     | cccc |
    | ddd | vvv  |`

    r := strings.NewReader(text)
    fmt.Println(org.HTML(r))
    fmt.Println(org.Debug(r))

    r1 := render.HTML{
        Toc: true,
        Document: org.New(r),
    }
    fmt.Println(r1.String())

    r2 := render.Debug{
        Document: org.New(r),
    }
    fmt.Println(r2.String())
}