"<=" et al rendered incorrectly in code block on Windows

Steps to reproduce

Create a note with the following contents:

x <= y

Did you follow the troubleshooting guide? [Y/N]


Expected result

The characters “<=” should be rendered literally.

Actual result

The characters “<=” are rendered as a single “≤” (LESS-THAN OR EQUAL TO) character.

This happens only in the Windows app (Android and Linux do not exhibit this problem), and only in text formatted as inline code or as a code block.

Copying the text results in the correct “<=” sequence.

A number of character sequences are similarly affected, including at least “<=”, “>=”, “=>”, “!=”, “/=”, “<>”, “<=>”, “<==>”.


Obsidian version: v1.5.12
Installer version: v1.5.12
Operating system: Windows 10 Home 10.0.22621
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on


Additional information

Rendering “<=” as “≤” is particularly problematic in code blocks, since in many programming languages “<=” is a valid operator but “≤” is a syntax error.

The debug info says “Windows 10 Home 10.0.22621”, but I’m running Windows 11.

To be clear in the “Steps to reproduce”, the note should contain:

  • A line consisting of three backticks
  • A line with the text “x <= y” (a less-than character followed by an equals character)
  • A line consisting of three backticks

You can surround 3 backticks with 4 backticks to show 3 backticks in this forum. You can surround 4 with 5 to show 5, etc.

x <= y

I see this in Windows too, but not MacOS. It’s likely that the font you are using is rendering “ligatures”. What font are you set to? (The font that is being used in your code blocks is probably the one in Appearance → Font → Monospace Font.

If you have nothing set, it will be using a default. I don’t know what the default is. For Windows it seems like it should be “Consolas”, but if I set it to Consolas, the ligatures disappear.

So that’s your workaround if you don’t like the ligatures. Set your own font, and Consolas might be a good choice.

(And this might be a bug if Obsidian is supposed to use the Windows default. I’m just giving you explanation and workaround for now.)

If you copy from the code block, it should copy the individual characters, even if it’s rendering a ligature. It should only copy the ≤ character if you copy from Reading mode.

Obsidian 1.6.0 will use Cascadia Mono on windows

1 Like

Glad to hear this will be fixed, and that there’s a workaround.

I can confirm that, with Obsidian 1.5.12 on Windows, setting the monospace font to Obsidian Mono works around the problem. “<=” is displayed as “<=” with Obsidian Mono, and setting it to Obsidian Code triggers the problem. (No custom font is applied initially, so I suppose it’s using a system default.)

(It’s odd that MS Word renders “<=” as “<=” using either Cascadia Code or Cascadia Mono.)

In any case, apparently the rendering of “<=” as “≤” is a deliberate feature of the Cascadia Code font – one that I personally find horrifying. But that’s a rant for another forum.

1 Like

Whoops, I typed the font names wrong in my previous comment. It’s “Cascadia Code” and “Cascadia Mono”, not “Obsidian Code” and “Obsidian Mono”.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.