diff --git a/lib/inlines.js b/lib/inlines.js index 1ecf8eef..1f0cbb7c 100644 --- a/lib/inlines.js +++ b/lib/inlines.js @@ -980,7 +980,11 @@ var parseInline = function(block) { // Parse string content in block into inline children, // using refmap to resolve references. var parseInlines = function(block) { - this.subject = block._string_content.trim(); + // trim() removes non-ASCII whitespaces, vertical tab, form feed and so on. + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#return_value + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#white_space + // Removes only ASCII tab and space. + this.subject = block._string_content.replace(/^[\t \r\n]+|[\t \r\n]+$/g, "") this.pos = 0; this.delimiters = null; this.brackets = null; diff --git a/test/regression.txt b/test/regression.txt index 40630a7b..6de5a111 100644 --- a/test/regression.txt +++ b/test/regression.txt @@ -518,3 +518,31 @@ foo more -->
foo
foo more -->
```````````````````````````````` + +#261 +```````````````````````````````` example +Vertical Tab + +Form Feed + + NBSP (U+00A0) NBSP + + Em Space (U+2003) Em Space + + Line Separator (U+2028) Line Separator + + Paragraph Separator (U+2029) Paragraph Separator + + 全角スペース (U+3000) 全形空白 + +ZWNBSP (U+FEFF) ZWNBSP +. +Vertical Tab
+Form Feed
+NBSP (U+00A0) NBSP
+Em Space (U+2003) Em Space
+Line Separator (U+2028) Line Separator
+Paragraph Separator (U+2029) Paragraph Separator
+全角スペース (U+3000) 全形空白
+ZWNBSP (U+FEFF) ZWNBSP
+````````````````````````````````