Make common flags and extensions public

Add DefaultOptions convenience variable.
This commit is contained in:
Vytautas Šaltenis 2016-03-30 19:29:00 +03:00
parent dc7d4b68df
commit 4d74c6a071
2 changed files with 9 additions and 6 deletions

View File

@ -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) {

View File

@ -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.