datocms-structured-text-generic-html-renderer
Advanced tools
Comparing version 0.1.0-alpha.8 to 0.1.0-alpha.9
@@ -66,5 +66,11 @@ "use strict"; | ||
var marks = node.marks || []; | ||
var lines = node.value.split(/\n/); | ||
var textWithNewlinesConvertedToBr = lines.length > 0 | ||
? lines.slice(1).reduce(function (acc, line) { | ||
return acc.concat([renderNode('br'), line]); | ||
}, [lines[0]]) | ||
: renderText(node.value, key); | ||
return marks.reduce(function (children, mark) { | ||
return renderNode(markToTagName(mark), { key: key }, children); | ||
}, renderText(node.value, key)); | ||
}, textWithNewlinesConvertedToBr); | ||
}), | ||
@@ -71,0 +77,0 @@ ])); |
{ | ||
"name": "datocms-structured-text-generic-html-renderer", | ||
"version": "0.1.0-alpha.8", | ||
"version": "0.1.0-alpha.9", | ||
"description": "A set of Typescript types and helpers to work with DatoCMS Structured Text fields", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "c5ae26acc4277dc5497eb69e811f6219ea716a78" | ||
"gitHead": "fbd819fff710650d8a1cacfea8b05fa860037dfe" | ||
} |
Sorry, the diff of this file is not supported yet
10361
82