nue icon indicating copy to clipboard operation
nue copied to clipboard

Nested content does not support lists when it's the first content

Open goblinfactory opened this issue 11 months ago • 1 comments

Describe the Bug

Nested content does not support lists and crashes with

 | export function renderBlocks(blocks, opts = {}) {
16 |   return blocks.map(b => renderBlock(b, opts)).join('\n')
              ^
TypeError: undefined is not an object (evaluating 'blocks.map')
      at renderBlocks (/Users/alanhemmings/src/goblinfactory-limited/goblinfactory-blog-2024/node_modules/nuemark/src/render-blocks.js:16:10)
      at block (/Users/alanhemmings/src/goblinfactory-limited/goblinfactory-blog-2024/node_modules/nuemark/src/render-tag.js:28:38)
      at map (1:11)
      at renderBlocks (/Users/alanhemmings/src/goblinfactory-limited/goblinfactory-blog-2024/node_modules/nuemark/src/render-blocks.js:16:17)
      at render (/Users/alanhemmings/src/goblinfactory-limited/goblinfactory-blog-2024/node_modules/nuemark/src/parse-document.js:46:59)
      at renderPage (/Users/alanhemmings/src/goblinfactory-limited/goblinfactory-blog-2024/node_modules/nuekit/src/layout/page.js:131:28)
      at /Users/alanhemmings/src/goblinfactory-limited/goblinfactory-blog-2024/node_modules/nuekit/src/nuekit.js:127:22

Minimal Reproduction

Follow the getting started and create a new Emma Bennet blog.

Edit the Contact me markdown from

[.stack]
  # Contact me
  I'm currently available for hire

to

[.stack]
  - item 1
  - item 2
  I'm currently available for hire

and this will crash.

HINT Observe that adding in a header above the list item stops it from crashing. so only crashes when the first child content is a list. For example, this does NOT crash

[.stack]
  # Contact me
  - list item 1
  - list item 2
  I'm currently available for hire

goblinfactory avatar Feb 01 '25 17:02 goblinfactory

With the new yaml parsing this should not happen anymore, but testing it to be sure would be better.

nobkd avatar Oct 15 '25 02:10 nobkd