macdown icon indicating copy to clipboard operation
macdown copied to clipboard

insert 2 spaces instead of tabs

Open YuhangGe opened this issue 9 years ago • 3 comments

I like 2 spaces for code indent, but it use 4 spaces by default.

so I wish macdown could add a preference to set count of spaces.

YuhangGe avatar Oct 25 '16 08:10 YuhangGe

Unfortunately indenting with two spaces does not work with the current Markdown parser. Code blocks work fine, but indenting in general will be broken because the (original) Markdown spec did not consider indentation sizes other than 4.

This will likely be addressed when (if?) we move to another parser, but for the time being, this is not fixable.

uranusjr avatar Oct 25 '16 09:10 uranusjr

Indentation size other than 4 is not considered valid by CommonMark:

An indented chunk is a sequence of non-blank lines, each indented four or more spaces.

Indentation with 2 spaces in a stand-alone Markdown file is not common in the community. @YuhangGe Any use case (e.g. some blogging engine) where 2 space is mandatory?

FranklinYu avatar Oct 28 '16 02:10 FranklinYu

The problem is that some applications can accept 4 spaces as 2x2 == 2 tabs. Another problem that other applications want 3 spaces as tab. So the solution is to have setting for tab spaces number (#438, #1019). IMHO

tieugene avatar Nov 11 '21 17:11 tieugene