Elderjs / elderjs

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.

Home Page:https://elderguide.com/tech/elderjs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Props in shortcode are passed as an Array instead of Object

NoelOConnell opened this issue · comments

commented

When trying to create a shortcode for our site I noticed an issue with the props argument received in the shortcode run function.

I cloned and ran the Elderjs template project to make sure our configuration was not causing the issue.

Steps to reproduce

  • Clone the Elderjs template
  • Edit the getting-started.md and add the box shortcode that is shown in the documentation page.
{{box type="gray"}}
  Your content here
{{/box}}

Expected output of props in the shortcode function
{ type: "gray" }

Actual
[ type: 'gray' ]

image
image

Hi, thanks for this. So I can try and recreate, can you let me know your output of npx envinfo --system --npmPackages svelte,rollup,webpack --binaries? Thanks

commented

Sure, here's the output

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 20.58 GB / 31.92 GB
  Binaries:
    Node: 14.15.4 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD      
    npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    rollup: ^2.41.1 => 2.47.0 
    svelte: ^3.38.3 => 3.38.3 

I also tried it running wsl2 on Windows and had the same issue.
Here's the output of that.

  System:
    OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 23.88 GB / 24.99 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.17.6 - /usr/local/bin/node
    Yarn: 1.22.5 - /mnt/c/Program Files (x86)/Yarn/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
  npmPackages:
    rollup: ^2.41.1 => 2.47.0
    svelte: ^3.38.3 => 3.38.3

Turns out this was a legacy issue with the forked https://github.com/elderjs/shortcodes. I've updated it to always return an object. It is part of the latest release of Elder.js.