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
Expected Behavior Normal ordered list.
Error Messages and Screenshots
Here is the error when I remove the empty line before /each:
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]
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:
{#each}
block?