micromark / micromark

small, safe, and great commonmark (optionally gfm) compliant markdown parser
https://unifiedjs.com
MIT License
1.75k stars 64 forks source link

crash on reference like structure before directive with parenthesis #43

Closed ChristianMurphy closed 3 years ago

ChristianMurphy commented 3 years ago

Subject of the issue

const micromark = require("micromark/lib");
const directive = require("micromark-extension-directive");

micromark( "[!]:)", "utf-8", { extensions: [directive()] });

throws

AssertionError [ERR_ASSERTION]: expected non-empty token (`chunkString`)

Your environment

Steps to reproduce

run:

const micromark = require("micromark/lib");
const directive = require("micromark-extension-directive");

micromark( "[!]:)", "utf-8", { extensions: [directive()] });

Expected behavior

No error, or a more specific markdown syntax related error

Actual behavior

AssertionError [ERR_ASSERTION]: expected non-empty token (`chunkString`)
wooorm commented 3 years ago

This is a bug in mm apparently! definitions!

wooorm commented 3 years ago

A clearer example is [x]: )

wooorm commented 3 years ago

Fixed! Thanks for the wonderful crash reports @ChristianMurphy!