fix(md): ensure list offset when rendering (#19241)

This commit is contained in:
Pavel Feldman 2022-12-02 16:33:51 -08:00 committed by GitHub
parent 6d82460a02
commit 291ad6e618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -283,8 +283,8 @@ function render(nodes, options) {
*/ */
function innerRenderMdNode(indent, node, lastNode, result, options) { function innerRenderMdNode(indent, node, lastNode, result, options) {
const newLine = () => { const newLine = () => {
if (result.length && result[result.length - 1] !== '') if (result.length && (result[result.length - 1] || '').trim() !== '')
result.push(''); result.push(indent);
}; };
if (node.type.startsWith('h')) { if (node.type.startsWith('h')) {