-
-
Notifications
You must be signed in to change notification settings - Fork 486
Closed
Labels
Description
It works for any other letter besides "h", but breaks when in angle brackets, pared with an integer - whether the brackets are escaped or not.
good:
a1
<a1>
\<a1\>
h1
<9h>
bad:
<h2>
\<h2\>
\<hh2\>
\<h2h\>
Here's the stack:
/usr/local/lib/node_modules/doctoc/lib/get-html-headers.js:11
if (new RegExp(x.text[0]).test(line)) {
^
SyntaxError: Invalid regular expression: /
* HTML5 container semantics
* proper use of [**\/: \ at end of pattern
at new RegExp (<anonymous>)
at /usr/local/lib/node_modules/doctoc/lib/get-html-headers.js:11:11
at Array.map (native)
at addLinenos (/usr/local/lib/node_modules/doctoc/lib/get-html-headers.js:8:18)
at module.exports (/usr/local/lib/node_modules/doctoc/lib/get-html-headers.js:66:13)
at transform (/usr/local/lib/node_modules/doctoc/lib/transform.js:127:13)
at /usr/local/lib/node_modules/doctoc/doctoc.js:26:20
at Array.map (native)
at transformAndSave (/usr/local/lib/node_modules/doctoc/doctoc.js:24:6)
at Object.<anonymous> (/usr/local/lib/node_modules/doctoc/doctoc.js:66:1)