quizdown-js icon indicating copy to clipboard operation
quizdown-js copied to clipboard

Character `<` in code blocks causes failure

Open tkgregory opened this issue 2 years ago • 0 comments

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>
</html>

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, the same markup works without issue.

tkgregory avatar Jun 08 '23 16:06 tkgregory