From 3ffe8c7f6b8f7e2026a2aee3477fb63fc33b33ff Mon Sep 17 00:00:00 2001 From: choueric Date: Wed, 22 Feb 2017 09:15:46 +0800 Subject: [PATCH] add extension to join lines --- inline.go | 4 ++++ markdown.go | 1 + 2 files changed, 5 insertions(+) diff --git a/inline.go b/inline.go index cb00ed6..c1f7475 100644 --- a/inline.go +++ b/inline.go @@ -170,6 +170,10 @@ func lineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) int { precededByBackslash := offset >= 1 && data[offset-1] == '\\' // see http://spec.commonmark.org/0.18/#example-527 precededByBackslash = precededByBackslash && p.flags&EXTENSION_BACKSLASH_LINE_BREAK != 0 + if p.flags&EXTENSION_JOIN_LINES != 0 { + return 1 + } + // should there be a hard line break here? if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && !precededByTwoSpaces && !precededByBackslash { return 0 diff --git a/markdown.go b/markdown.go index 58ba68d..09fc2d7 100644 --- a/markdown.go +++ b/markdown.go @@ -46,6 +46,7 @@ const ( EXTENSION_AUTO_HEADER_IDS // Create the header ID from the text EXTENSION_BACKSLASH_LINE_BREAK // translate trailing backslashes into line breaks EXTENSION_DEFINITION_LISTS // render definition lists + EXTENSION_JOIN_LINES // delete newline and join lines commonHtmlFlags = 0 | HTML_USE_XHTML |