markdownfmt: github.com/shurcooL/markdownfmt/markdown Index | Examples | Files

package markdown

import "github.com/shurcooL/markdownfmt/markdown"

Package markdown provides a Markdown renderer.

Code:

input := []byte(`Title
=

This is a new paragraph. I wonder    if I have too     many spaces.
What about new paragraph.
But the next one...

  Is really new.

1. Item one.
1. Item TWO.


Final paragraph.
`)

output, err := markdown.Process("", input, nil)
if err != nil {
    log.Fatalln(err)
}

os.Stdout.Write(output)

Output:

Title
=====

This is a new paragraph. I wonder if I have too many spaces. What about new paragraph. But the next one...

Is really new.

1.	Item one.
2.	Item TWO.

Final paragraph.

Code:

input := []byte(`Title
==

Subtitle
---

How about ` + "`this`" + ` and other stuff like *italic*, **bold** and ***super    extra***.
`)

output, err := markdown.Process("", input, nil)
if err != nil {
    log.Fatalln(err)
}

os.Stdout.Write(output)

Output:

Title
=====

Subtitle
--------

How about `this` and other stuff like *italic*, **bold** and ***super extra***.

Index

Examples

Package Files

main.go

func NewRenderer Uses

func NewRenderer(opt *Options) blackfriday.Renderer

NewRenderer returns a Markdown renderer. If opt is nil the defaults are used.

func Process Uses

func Process(filename string, src []byte, opt *Options) ([]byte, error)

Process formats Markdown. If opt is nil the defaults are used. Error can only occur when reading input from filename rather than src.

type Options Uses

type Options struct {
    // Terminal specifies if ANSI escape codes are emitted for styling.
    Terminal bool
}

Options specifies options for formatting.

Package markdown imports 8 packages (graph) and is imported by 7 packages. Updated 2017-02-17. Refresh now. Tools for package owners.