Bug Description If I have a code like this:

{#each something as thing}
1. {thing.name}

{/each}

I expect ordered list. However I get 1. always.

Also, {/each} must be set in this case after empty line, or evidence errors.

On Slack, it is said that issue is due to md compiler, MDSveX.

Severity

  • [x] Low - I'm able to keep using Evidence as normal, but flagging this for the team to fix

Expected Behavior Normal ordered list.

Error Messages and Screenshots

Here is the error when I remove the empty line before /each:

image

Note: I can't copy paste this err without OCR, you should fix that too.

Workarounds One workaround is to use custom iterator:

<script>
   {i=0}
</script>

{#each categories as category}

{++i}. {category.category}

{/each}

or

{#each categories as category, i}

{++i}. {category.category}

{/each}

The other method is to use html:

<ol>
{#each forms as form, i}

<li>{form.name}</li>

{/each}
</ol>

Do you want to contribute a fix for this bug? If so, let us know and we can help you get started.

Environment Information Operating System (e.g., MacOS, Windows 10): Windows 10 Node version (node -v): 19.0 npm version (npm -v): 8.19.3 Package versions (npm list --depth=0): @evidence-dev/[email protected]

0

Adding context:

This is due to the way MDSveX parses each blocks.

We don't have a good fix right now, the workarounds above are probably the best solution at this stage.

The final version that would also work is

<ol>
{#each forms as form}
  <li>{form.name}</li>
{/each}
</ol>

Possible avenues to fix:

  • Change our markdown compiler to something else
  • Create our own Each component that wraps the functionality of Svelte's {#each} block?
0
© 2022 pullanswer.com - All rights reserved.