Add spaces_per_tab parameter to MD010/no-hard-tabs (fixes #384). (#385)

This commit is contained in:
Yash Singh 2021-04-09 16:33:01 -07:00 committed by GitHub
parent 6302b26c99
commit 47ff95e8d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 157 additions and 4 deletions

View file

@ -2143,6 +2143,10 @@ module.exports = {
"function": function MD010(params, onError) {
var codeBlocks = params.config.code_blocks;
var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
var spacesPerTab = params.config.spaces_per_tab;
var spaceMultiplier = (spacesPerTab === undefined) ?
1 :
Math.max(0, Number(spacesPerTab));
forEachLine(lineMetadata(), function (line, lineIndex, inCode) {
if (!inCode || includeCodeBlocks) {
var match = null;
@ -2152,7 +2156,7 @@ module.exports = {
addError(onError, lineIndex + 1, "Column: " + column, null, [column, length_1], {
"editColumn": column,
"deleteCount": length_1,
"insertText": "".padEnd(length_1)
"insertText": "".padEnd(length_1 * spaceMultiplier)
});
}
}