Skip to content

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

@goblinfactory

Description

@goblinfactory

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    nuemarkRelated to nuemark package

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions