bonartm / quizdown-js

Markdown syntax for generating interactive quizzes in the browser
https://bonartm.github.io/quizdown-live-editor/
MIT License
88 stars 24 forks source link

Character `<` in code blocks causes failure #44

Open tkgregory opened 1 year ago

tkgregory commented 1 year ago

When I try to render a code block containing <, a failure occurs:

TypeError: Cannot read properties of undefined (reading 'items'). App could not render. Please check your quizdown syntax.

This is the full HTML page:

<html>
    <head>
        <script src="https://cdn.jsdelivr.net/npm/quizdown@latest/public/build/quizdown.js">
        </script>
        <script>quizdown.init();</script>
    </head>
    <body>
        <div class="quizdown">
            ---
            primaryColor: steelblue
            shuffleQuestions: false
            shuffleAnswers: true
            ---

            ### Select your superpowers!

            ```plaintext
            Property<String>
        - [ ] Enhanced Strength
        - [ ] Levitation
        - [x] Shapeshifting
    </div>
</body>



When I remove the `<` character, the quiz renders fine.

`<` is a pretty common character in Java code (and probably other languages) so I expect this to be rendered successfully like other code.

I've noticed that when I use the [Quizdown Editor](https://bonartm.github.io/quizdown-live-editor), the same markup works without issue.