From 8a04460c3ee541649008321b7982c67d7c20b7d0 Mon Sep 17 00:00:00 2001 From: Dennis Richter Date: Tue, 30 Apr 2024 10:20:22 +0200 Subject: [PATCH] Fix predentation task can't handle empty lines If the predentation task faces an empty line the indentation level getting set to -1 and this messes up the corresponding code blocks indentation in the final result --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1688fa15..4e9d1002 100644 --- a/index.js +++ b/index.js @@ -102,7 +102,7 @@ module.exports = function (options) { // Determine the level of indentation lines.forEach(function(line) { if (line[0] === '<') return; - var wsp = line.search(/\S/) + var wsp = line.search(/\S|$/) level = (level === null || (wsp < line.length && wsp < level)) ? wsp : level; })