Skip to content

Latest commit

 

History

History
55 lines (34 loc) · 1.86 KB

File metadata and controls

55 lines (34 loc) · 1.86 KB

MD010 - Hard tabs

Tags: hard_tab, whitespace

Aliases: no-hard-tabs

Parameters:

  • code_blocks: Include code blocks (boolean, default true)
  • ignore_code_languages: Fenced code languages to ignore (array, default [])
  • spaces_per_tab: Number of spaces for each hard tab (integer, default 1)

Fixable: Some violations can be fixed by tooling

This rule is triggered by any lines that contain hard tab characters instead of using spaces for indentation. To fix this, replace any hard tab characters with spaces instead.

Example of violation:

Some text

	* hard tab character used to indent the list item

Corrected example:

Some text

 * Spaces used to indent the list item instead

Hard tabs are often rendered inconsistently by different editors and can be harder to work with than spaces. This rule ensures consistent indentation throughout your Markdown files.

Configuration

The code_blocks parameter controls whether code blocks are checked for hard tabs. By default, code blocks are checked (true).

The ignore_code_languages parameter allows you to specify an array of programming languages where hard tabs should be ignored in fenced code blocks. This is useful for languages like Makefiles or Go where tabs have semantic meaning:

[linters.settings.no-hard-tabs]
ignore_code_languages = ["makefile", "go"]

The spaces_per_tab parameter determines how many spaces should replace each hard tab when suggesting fixes. The default is 1 space per tab:

[linters.settings.no-hard-tabs]
spaces_per_tab = 4

With this configuration, violations will suggest replacing tabs with 4 spaces instead of 1.

Rationale: Hard tabs are often rendered inconsistently by different editors and can be harder to work with than spaces. Using spaces ensures consistent indentation appearance across all editors and tools.