mark

package module
v0.0.0-...-f8336c8 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: MIT Imports: 9 Imported by: 1

README

##Mark

Mark is a markdown parser implemented in Go. It's fast and support extension such as Table,fence code,etc.It is safe for utf-8 input.

The parser idea comes from chjj/marked. But it isn't as complete as chjj/marked

###Installation

Mark is compatible with go1.4.2 (I don't know whether compatible with go version under 1.4.2)

With go and git installed

Install pcre

sudo apt-get install libpcre++-dev // In Ubuntu
brew install pcre				   // In Mac OS X

Get markdown parser

go get github.com/superhx/mark

###Usage

####Code

Basic usage, read a bytes then parse it to Markdown , render Markdown and output

//marker parse the input and return a Markdown object
mark:=mark.Mark(input)
//writer io.Writer
//render markdown to html and output to writer(without style sheet,see markdown_test to pretty)
writer := mark.NewHTMLWriter(mark)
writer.WriteTo(output)

The Markdown is like a tree (dom tree)

If you want to operate the Markdown instead of only simple output it. It is all free for you to modify the Markdown tree as you want. The markdown.go contain all struct in Markdown tree.

###Markdown Grammar Support

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTMLWriter

func NewHTMLWriter(node Node) io.WriterTo

NewHTMLWriter ...

Types

type BlockRex

type BlockRex struct {
	// contains filtered or unexported fields
}

BlockRex ...

type BlockText

type BlockText struct {
	*Text
}

BlockText ...

type Blockquote

type Blockquote struct {
	Parts []Node
}

Blockquote ...

type Br

type Br struct {
}

Br ...

type Code

type Code struct {
	Lang string
	Text string
}

Code ...

type Def

type Def struct {
	Href  string
	Title string
}

Def ...

type Del

type Del struct {
	Text string
}

Del ...

type Em

type Em struct {
	Text string
}

Em ...

type HTML

type HTML struct {
	Text string
}

HTML ...

type HTMLWriter

type HTMLWriter struct {
	Node Node
}

HTMLWriter is ...

func (HTMLWriter) WriteTo

func (html HTMLWriter) WriteTo(w io.Writer) (n int64, err error)

WriteTo ...

type Heading

type Heading struct {
	Depth int
	Text  *Text
}

Heading ...

type Hr

type Hr struct {
}

Hr ...

type Image

type Image struct {
	Text  string
	Href  string
	Title string
}

Image ...

type InlineCode

type InlineCode struct {
	Text string
}

InlineCode ...

type InlineRex

type InlineRex struct {
	// contains filtered or unexported fields
}

InlineRex ...

type InlineText

type InlineText struct {
	Text string
}

InlineText ...

type Item

type Item struct {
	*List
	Parts []Node
}

Item ...

type Link struct {
	Text  string
	Href  string
	Title string
}

Link ...

type List

type List struct {
	Items   []*Item
	Ordered bool
}

List ...

type MarkDown

type MarkDown struct {
	Parts []Node
}

MarkDown ...

func Mark

func Mark(strBytes []byte) (markdown *MarkDown)

Mark parse the markdown file,then return MarkDown Obj

type Marker

type Marker struct {
	// contains filtered or unexported fields
}

Marker is a mark parser for markdown

type Node

type Node interface {
}

Node is a interface

type Nptable

type Nptable struct {
	Header []string
	Align  []string
	Cells  [][]*Text
}

Nptable ...

type Space

type Space struct {
}

Space ...

type Strong

type Strong struct {
	Text string
}

Strong ...

type Text

type Text struct {
	Parts []Node
}

Text ...

type WriterWrapper

type WriterWrapper struct {
	// contains filtered or unexported fields
}

WriterWrapper ...

func (WriterWrapper) Error

func (wrapper WriterWrapper) Error() (err error)

func (WriterWrapper) NumberOfBytes

func (wrapper WriterWrapper) NumberOfBytes() (n int64)

NumberOfBytes ...

func (*WriterWrapper) Write

func (wrapper *WriterWrapper) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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