From 4d74c6a07120697f918d6fb4b90a2d3ee3355665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Wed, 30 Mar 2016 19:29:00 +0300 Subject: [PATCH] Make common flags and extensions public Add DefaultOptions convenience variable. --- inline_test.go | 2 +- markdown.go | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/inline_test.go b/inline_test.go index 35539ef..2882e45 100644 --- a/inline_test.go +++ b/inline_test.go @@ -42,7 +42,7 @@ func doLinkTestsInline(t *testing.T, tests []string) { params := HtmlRendererParameters{AbsolutePrefix: prefix} transformTests := transformLinks(tests, prefix) doTestsInlineParam(t, transformTests, Options{}, 0, params) - doTestsInlineParam(t, transformTests, Options{}, commonHtmlFlags, params) + doTestsInlineParam(t, transformTests, Options{}, CommonHtmlFlags, params) } func doSafeTestsInline(t *testing.T, tests []string) { diff --git a/markdown.go b/markdown.go index f964eee..b000220 100644 --- a/markdown.go +++ b/markdown.go @@ -50,14 +50,18 @@ const ( BackslashLineBreak // Translate trailing backslashes into line breaks DefinitionLists // Render definition lists - commonHtmlFlags HtmlFlags = UseXHTML | UseSmartypants | + CommonHtmlFlags HtmlFlags = UseXHTML | UseSmartypants | SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes - commonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode | + CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode | Autolink | Strikethrough | SpaceHeaders | HeaderIDs | BackslashLineBreak | DefinitionLists ) +var DefaultOptions = Options{ + Extensions: CommonExtensions, +} + type LinkType int // These are the possible flag values for the link renderer. @@ -364,9 +368,8 @@ func MarkdownBasic(input []byte) []byte { // * Custom Header IDs func MarkdownCommon(input []byte) []byte { // set up the HTML renderer - renderer := HtmlRenderer(commonHtmlFlags, "", "") - return MarkdownOptions(input, renderer, Options{ - Extensions: commonExtensions}) + renderer := HtmlRenderer(CommonHtmlFlags, "", "") + return MarkdownOptions(input, renderer, DefaultOptions) } // Markdown is the main rendering function.