zestedesavoir / zmarkdown

Live demo: https://zestedesavoir.github.io/zmarkdown/
MIT License
226 stars 52 forks source link

zmarkdown: inverting line number of a range causes a fatal error #414

Closed artragis closed 3 years ago

artragis commented 3 years ago

The bug only appears with current zmarkdown configuration, you just have to start the server and send provided markdown

The minimal code

```php hl_lines="3-01"
<?php

namespace App\Validator;

observed behaviour

error is raised in zmarkdown/utils/code-handler.js at line 70

RangeError

Invalid array length

desired behaviour

two possible behaviour :

StaloneLab commented 3 years ago

I saw this error, and I think it's obviously a misuse of the plugin, but anyway adding a check is no big deal.

artragis commented 3 years ago

It's juste we don't want the parsing to be stopped when users makes a typo.