From 0cb0db78d0f2d1fa362c8b62bb000547a254b1f5 Mon Sep 17 00:00:00 2001 From: Thomas Verleye Date: Wed, 8 Sep 2021 08:39:22 +0200 Subject: [PATCH] Make blockquote WHATWG compliant For further details on the correct notation I'd like to refer to the docs: https://html.spec.whatwg.org/multipage/grouping-content.html#the-blockquote-element --- packages/generic-html-renderer/src/index.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/generic-html-renderer/src/index.ts b/packages/generic-html-renderer/src/index.ts index 546a427..a1b9c98 100644 --- a/packages/generic-html-renderer/src/index.ts +++ b/packages/generic-html-renderer/src/index.ts @@ -102,13 +102,11 @@ export function render< renderRule( isBlockquote, ({ adapter: { renderNode }, key, node, children }) => { - const childrenWithAttribution = node.attribution - ? [ - ...(children || []), - renderNode(`footer`, { key: 'footer' }, node.attribution), - ] - : children; - return renderNode('blockquote', { key }, childrenWithAttribution); + const childrenWithBlockquote = [renderNode('blockquote', { key: 'blockquote' }, children)]; + if (node.attribution) { + childrenWithBlockquote.push(renderNode('p', { key: 'attribution' }, node.attribution)); + } + return renderNode('p', { key }, childrenWithBlockquote); }, ), renderRule(isCode, ({ adapter: { renderNode, renderText }, key, node }) => {