confluence

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 3 Imported by: 0

README

Blackfriday-Confluence

CircleCI godoc Coverage Status Go Report Card license

Blackfriday-Confluence is confluence wiki renderer for the Blackfriday v2 markdown processor.

Features

Installation

$ go get -u github.com/kentaro-m/blackfriday-confluence

Usage

import (
  bf "gopkg.in/russross/blackfriday.v2"
  bfconfluence "github.com/kentaro-m/blackfriday-confluence"
)

// ...
renderer := &bfconfluence.Renderer{}
extensions := bf.CommonExtensions
md := bf.New(bf.WithRenderer(renderer), bf.WithExtensions(extensions))
input := "# sample text" // # sample text
ast := md.Parse([]byte(input))
output := renderer.Render(ast) // h1. sample text
fmt.Printf("%s\n", output)
// ...

Examples

Input
# Section
Some _Markdown_ text.

## Subsection
Foobar.

### Subsubsection
Fuga

> quote

- - - -

**strong text**
~~strikethrough text~~
[Example Domain](http://www.example.com/)
![](https://blog.golang.org/gopher/header.jpg)

* list1
* list2
* list3

hoge

1. number1
2. number2
3. number3

First Header  | Second Header
------------- | -------------
Content Cell  | Content Cell
Content Cell  | Content Cell

|a  |b  |c  |
|---|---|---|
|1  |2  |3  |
|4  |5  |6  |
package main
import "fmt"
func main() {
    fmt.Println("hello world")
}
Output
h1. Section
Some _Markdown_ text.

h2. Subsection
Foobar.

h3. Subsubsection
Fuga

{quote}
quote

{quote}

----
*strong text*
-strikethrough text-
[http://www.example.com/|Example Domain]
!https://blog.golang.org/gopher/header.jpg!

* list1
* list2
* list3

hoge

# number1
# number2
# number3

||First Header||Second Header||
|Content Cell|Content Cell|
|Content Cell|Content Cell|

||a||b||c||
|1|2|3|
|4|5|6|
{code:go}
package main
import "fmt"
func main() {
    fmt.Println("hello world")
}
{code}

Documentation

GoDoc

Contributing

Issue
  • 🐛 Report a bug
  • 🎁 Request a feature

Please use the GitHub Issue to create a issue.

Pull Request
  1. Fork it (https://github.com/kentaro-m/blackfriday-confluence/fork)
  2. Create your feature branch
  3. Run the test ($ go test) and make sure it passed ✅
  4. Commit your changes 📝
  5. Push to the branch
  6. Create a new Pull Request ❤

Thanks

Blackfriday-Confluence is inspired by Blackfriday-LaTeX.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(input []byte, opts ...bf.Option) []byte

Run prints out the confluence document.

Types

type Flag

type Flag int

Flag control optional behavior of this renderer.

const (
	// FlagsNone does not allow customizing this renderer's behavior.
	FlagsNone Flag = 0

	// InformationMacros allow using info, tip, note, and warning macros.
	InformationMacros Flag = 1 << iota

	// IgnoreMacroEscaping will not escape any text that contains starts with `{`
	// in a block of text.
	IgnoreMacroEscaping
)

type Renderer

type Renderer struct {

	// Flags allow customizing this renderer's behavior.
	Flags Flag
	// contains filtered or unexported fields
}

Renderer is the rendering interface for confluence wiki output.

func (*Renderer) Render

func (r *Renderer) Render(ast *bf.Node) []byte

Render prints out the whole document from the ast.

func (*Renderer) RenderFooter

func (r *Renderer) RenderFooter(w io.Writer, ast *bf.Node)

RenderFooter writes document footer (unused).

func (*Renderer) RenderHeader

func (r *Renderer) RenderHeader(w io.Writer, ast *bf.Node)

RenderHeader writes document header (unused).

func (*Renderer) RenderNode

func (r *Renderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf.WalkStatus

RenderNode is a confluence renderer of a single node of a syntax tree.

Jump to

Keyboard shortcuts

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