Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
goblinfactory opened this issue Feb 1, 2025 · 0 comments · May be fixed by #472
Open

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

goblinfactory opened this issue Feb 1, 2025 · 0 comments · May be fixed by #472
Labels
bug nuemark Related to nuemark package

Comments

@goblinfactory
Copy link
Contributor

goblinfactory commented Feb 1, 2025

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
@nobkd nobkd added the nuemark Related to nuemark package label Feb 1, 2025
@goblinfactory goblinfactory changed the title Nested content does not support lists Nested content does not support lists when it's the first content Feb 1, 2025
@nobkd nobkd linked a pull request Feb 1, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug nuemark Related to nuemark package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants