support code blocks with multiple text nodes

This commit is contained in:
Shawn Erquhart 2017-09-28 11:35:01 -04:00
parent bbf165d3b0
commit 99673ee3cc

View File

@ -435,7 +435,9 @@ function convertNode(node, children, shortcodePlugins) {
* value and the "lang" data property to the new MDAST node.
*/
case 'code': {
const value = get(node.nodes, [0, 'text']);
const value = flatMap(node.nodes, child => {
return flatMap(child.ranges, 'text');
}).join('');
const { lang, ...data } = get(node, 'data', {});
return u(typeMap[node.type], { lang, data }, value);
}