From 2f588b24aa37643df6e31d1dc2a072a2aed39495 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 6 May 2020 04:50:54 +0200 Subject: Forbid empty atx header --- src/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/index.js b/src/index.js index 30d216d..e89c3b5 100644 --- a/src/index.js +++ b/src/index.js @@ -116,6 +116,10 @@ function tokenizeModifierGenerator(oldParser, config) { index = lastChild.value.lastIndexOf('{'); + if (index <= 0) { + return eaten; + } + const parsedAttr = parseAttr(lastChild.value, index, config.mdAttrConfig); if (parsedAttr.eaten.length !== lastChild.value.length - index) { @@ -127,6 +131,10 @@ function tokenizeModifierGenerator(oldParser, config) { index -= 1; } + if (index < 0) { + return eaten; + } + // If parsed configure the node if (parsedAttr) { if (config.scope && config.scope !== 'none') { -- cgit v1.2.3