mike239x
mike239x

Reputation: 215

Markdown - How to set tab size for 1 code block

I am working with a markdown file, got some code blocks. For one specific code block I want to forcefully set tab-size equal 6. How do I do that?

I got three ideas:

  1. Something-something info-string. Just like I write ```sql at the start of the code block, there could be a way to add something like tab-size = 6 or something. Haven't found any info about it though, and all my random guesses failed (tabsize, tabSize and tab-size).
  2. Changing style via html tag. For example,

    <span style = "font-size: 2em;">
    ```sql
    <some code here>
    ```
    </span>
    

    does indeed change size of code. So it should in theory change tab size if I write something like style = "tab-size: 6;". It doesn't. Moreover, I saw this post which mentions other properties like -o-tab-size, so I added all that to my span tag too. Still nothing.

Side note: using Markdown preview plus from atom, having tab-size equal 2. In Markdown preview (without plus) every tab is exchanged for 4 spaces. In Github tab-size is 6, but it is not because I set it so (checked with different value, didn't work).

  1. Just use spaces instead of tabs, this clearly will work.

So, yeah, how do I do such a thing?

Upvotes: 1

Views: 3128

Answers (1)

Waylan
Waylan

Reputation: 42467

Use spaces instead of tabs.

  1. The tab-size property is not supported by all browsers.
  2. Some sites (like GitHub) will strip out any style tags in the output for security reasons.
  3. Some Markdown parsers will convert all tabs to spaces anyway.

Given the above, the only way to consistently maintain control of your output is to use spaces. And that gives you absolute control of your code blocks.

Upvotes: 0

Related Questions