all repos — grayfriday @ 123179b8f31c1e45fc61490bf7df510cb3fa2876

blackfriday fork with a few changes

Make Markdown the most general API call

Get rid of MarkdownOptions.
Vytautas Ĺ altenis vytas@rtfb.lt
Tue, 05 Apr 2016 13:45:00 +0300
commit

123179b8f31c1e45fc61490bf7df510cb3fa2876

parent

83b4cb6062026552be18b31998adc933abb2c39c

2 files changed, 5 insertions(+), 13 deletions(-)

jump to
M markdown.gomarkdown.go

@@ -349,7 +349,7 @@ htmlFlags := UseXHTML

renderer := HTMLRenderer(htmlFlags, CommonExtensions, "", "") // set up the parser - return MarkdownOptions(input, renderer, Options{Extensions: 0}) + return Markdown(input, renderer, Options{Extensions: 0}) } // Call Markdown with most useful extensions enabled

@@ -374,7 +374,7 @@ // * Custom Header IDs

func MarkdownCommon(input []byte) []byte { // set up the HTML renderer renderer := HTMLRenderer(CommonHtmlFlags, CommonExtensions, "", "") - return MarkdownOptions(input, renderer, DefaultOptions) + return Markdown(input, renderer, DefaultOptions) } // Markdown is the main rendering function.

@@ -384,19 +384,11 @@ // which non-standard extensions are enabled.

// // To use the supplied Html or LaTeX renderers, see HtmlRenderer and // LatexRenderer, respectively. -func Markdown(input []byte, renderer Renderer, extensions Extensions) []byte { - return MarkdownOptions(input, renderer, Options{ - Extensions: extensions}) -} - -// MarkdownOptions is just like Markdown but takes additional options through -// the Options struct. -func MarkdownOptions(input []byte, renderer Renderer, opts Options) []byte { - // no point in parsing if we can't render +func Markdown(input []byte, renderer Renderer, options Options) []byte { if renderer == nil { return nil } - return renderer.Render(Parse(input, opts)) + return renderer.Render(Parse(input, options)) } func Parse(input []byte, opts Options) *Node {
M test_helpers.gotest_helpers.go

@@ -45,7 +45,7 @@

func runMarkdown(input string, params TestParams) string { renderer := HTMLRendererWithParameters(params.HTMLFlags, params.Options.Extensions, "", "", params.HTMLRendererParameters) - return string(MarkdownOptions([]byte(input), renderer, params.Options)) + return string(Markdown([]byte(input), renderer, params.Options)) } func doTestsBlock(t *testing.T, tests []string, extensions Extensions) {