Passing nonquoted boolean JSON argument to Preprocessor causes Marked to crash

connor's Avatar

connor

30 Mar, 2020 03:38 PM

Hey Brett! I think I found a crashing bug in Marked.

I have written a preprocessor script that takes two positional arguments. The first is a general string, and the second I am treating like a boolean flag. "true" and "yes" evaluate to true, otherwise false. Here's an example .md file (this version does not crash):

<!--
Custom Preprocessor: [true, "html", "true"]
-->

# A header

Some body.

The problem arises if I'm sloppy with quotes in the arguments. Nearly every combination of quoted and unquoted arguments works fine, but if I have the first positional argument quoted, but either the values true or false unquoted as the second argument, Marked crashes. e.g.:

Custom Preprocessor: [true, "html", true]

I'm probably taking liberties with JSON that are inappropriate, but nevertheless this is probably an exception worth catching rather than letting Marked simply crash, yes?

Thanks as always for a great app!

  1. Support Staff 1 Posted by Brett on 30 Mar, 2020 04:20 PM

    Brett's Avatar

    Yep, thanks for reporting.

    - Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac