mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add code_blocks parameter to MD010 to ignore hard tabs in code blocks (fixes #31).
This commit is contained in:
parent
c2982e2972
commit
a2df7742c6
6 changed files with 87 additions and 3 deletions
|
@ -328,8 +328,10 @@ module.exports = [
|
|||
"tags": [ "whitespace", "hard_tab" ],
|
||||
"aliases": [ "no-hard-tabs" ],
|
||||
"func": function MD010(params, errors) {
|
||||
params.lines.forEach(function forLine(line, lineIndex) {
|
||||
if (/\t/.test(line)) {
|
||||
var codeBlocks = params.options.code_blocks;
|
||||
var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
|
||||
forEachLine(params, function forLine(line, lineIndex, inCode) {
|
||||
if (/\t/.test(line) && (!inCode || includeCodeBlocks)) {
|
||||
errors.push(lineIndex + 1);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue