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

Props in shortcode are passed as an Array instead of Object #209

Closed
NoelOConnell opened this issue Sep 10, 2021 · 3 comments
Closed

Props in shortcode are passed as an Array instead of Object #209

NoelOConnell opened this issue Sep 10, 2021 · 3 comments

Comments

@NoelOConnell
Copy link

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

@nickreese
Copy link
Contributor

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

@NoelOConnell
Copy link
Author

NoelOConnell commented Sep 13, 2021

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

@nickreese
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants