Steps to reproduce
- open sandbox vault
- type below
– SPACE and , takes only half space
abcd
,
-- the issue does not exist inside code block
abcd
,,,,
3 you will see outside the codeblock, the , only takes halfspace
-- the issue does not exist inside code block
abcd
,,,,
3 you will see outside the codeblock, the , only takes halfspace
The width of each character depends on the font used.
In a code block, the font is typically one of fixed-width (also called monospaced), in which all characters have the same width. This is convenient to type code and have consistent indentation.
In the main text, however, a variable-width font is typically used because it is easier to read (this is why books and papers use this kind of font too). In these fonts the “m” is much wider than the “i”, for example.
You can change your Obsidian settings to have fixed-width font in the main text if you prefer. You can use for example “Consolas” (in windows) or Monaco in OSX. There are also lots of fonts designed for programmers (Source Code Pro, or many others).