Blackfriday Build Status

Blackfriday is a Markdown processor implemented in Go. It
is paranoid about its input (so you can safely feed it user-supplied
data), it is fast, it supports common extensions (tables, smart
punctuation substitutions, etc.), and it is safe for all utf-8
(unicode) input.

HTML output is currently supported, along with Smartypants
extensions. An experimental LaTeX output engine is also included.

It started as a translation from C of Sundown.


Blackfriday is compatible with Go 1. If you are using an older
release of Go, consider using v1.1 of blackfriday, which was based
on the last stable release of Go prior to Go 1. You can find it as a
tagged commit on github.

With Go 1 and git installed:

go get

will download, compile, and install the package into your $GOPATH
directory hierarchy. Alternatively, you can achieve the same if you
import it into a project:

import ""

and go get without parameters.


For basic usage, it is as simple as getting your input into a byte
slice and calling:

output := blackfriday.MarkdownBasic(input)

This renders it with no extensions enabled. To get a more useful
feature set, use this instead:

output := blackfriday.MarkdownCommon(input)

Sanitize untrusted content

Blackfriday itself does nothing to protect against malicious content. If you are
dealing with user-supplied markdown, we recommend running blackfriday’s output
through HTML sanitizer such as

Here’s an example of simple usage of blackfriday together with bluemonday:

import (

// ...
unsafe := blackfriday.MarkdownCommon(input)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)

Custom options

If you want to customize the set of options, first get a renderer
(currently either the HTML or LaTeX output engines), then use it to
call the more general Markdown function. For examples, see the
implementations of MarkdownBasic and MarkdownCommon in

You can also check out blackfriday-tool for a more complete example
of how to use it. Download and install it using:

go get

This is a simple command-line tool that allows you to process a
markdown file using a standalone program. You can also browse the
source directly on github if you are just looking for some example

Note that if you have not already done so, installing
blackfriday-tool will be sufficient to download and install
blackfriday in addition to the tool itself. The tool binary will be
installed in $GOPATH/bin. This is a statically-linked binary that
can be copied to wherever you need it without worrying about
dependencies and library versions.


All features of Sundown are supported, including:


In addition to the standard markdown syntax, this package
implements the following extensions:

Other renderers

Blackfriday is structured to allow alternative rendering engines. Here
are a few of note:



Blackfriday is distributed under the Simplified BSD License

Fork allmark on GitHub