2018-01-26 08:43:10 +00:00
|
|
|
// Package markdown implements markdown parser and HTML renderer.
|
2016-09-05 07:25:10 +00:00
|
|
|
//
|
2018-01-26 08:43:10 +00:00
|
|
|
// It parses markdown into AST format which can be serialized to HTML
|
2018-01-28 03:45:55 +00:00
|
|
|
// (using html.Renderer) or possibly other formats (using alternate renderers).
|
2016-09-05 07:25:10 +00:00
|
|
|
//
|
|
|
|
//
|
2018-01-26 22:46:02 +00:00
|
|
|
// Convert markdown to HTML
|
2016-09-05 07:25:10 +00:00
|
|
|
//
|
2018-01-28 03:45:55 +00:00
|
|
|
// The simplest way to convert markdown document to HTML
|
2018-01-26 23:14:20 +00:00
|
|
|
//
|
2018-01-26 22:46:02 +00:00
|
|
|
// md := []byte("## markdown document")
|
2018-01-26 23:06:32 +00:00
|
|
|
// html := markdown.ToHTML(md, nil, nil)
|
2018-01-26 08:43:10 +00:00
|
|
|
//
|
2018-01-26 22:46:02 +00:00
|
|
|
// Customizing parsing and HTML rendering
|
|
|
|
//
|
2018-01-28 03:45:55 +00:00
|
|
|
// You can customize parser and HTML renderer:
|
2018-01-26 23:15:17 +00:00
|
|
|
//
|
2018-01-26 22:46:57 +00:00
|
|
|
// md := []byte("markdown document")
|
2018-01-28 03:45:55 +00:00
|
|
|
// extensions := parser.CommonExtensions | parser.AutoHeadingIDs
|
|
|
|
// parser := parser.NewWithExensions(extensions)
|
2018-01-28 02:39:03 +00:00
|
|
|
// htmlParams := html.CommonFlags | html.HrefTargetBlank
|
2018-01-28 03:45:55 +00:00
|
|
|
// renderer := html.NewRenderer(htmlParams)
|
2018-01-26 23:06:32 +00:00
|
|
|
// html := markdown.ToHTML(md, parser, renderer)
|
2018-01-26 22:46:02 +00:00
|
|
|
//
|
|
|
|
// For a cmd-line tool see https://github.com/gomarkdown/markdown/tree/master/cmd/mdtohtml
|
2018-01-25 21:01:19 +00:00
|
|
|
package markdown
|