Nested and indented "ini" code blocks break formatting in editor

Steps to reproduce

Given the following content:

```ini
[section]
key=value
```
- A list item with an indented css block
  ```css
  .foo {
    color: blue;
  }
  ```
- A list item with an indented ini block
  ```ini
  [section]
  key=value
  ```
- Another list item that gets the wrong formatting in the editor

The editor (in both live preview and source modes) renders the third list item incorrectly:

Expected result

The syntax highlighting for the ini code block should end and the third list item should be displayed as plain text (as the second list item does)

Actual result

Environment

  • Operating system: macOS 12.2
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v0.14.2
    Installer version: v0.13.31
    Operating system: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 21.3.0
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Safe mode: on

RECOMMENDATIONS:
none


Additional information

The document renders in reading view just fine. This only occurs in the editor in both live preview and source modes.

4 Likes

Still happen on 1.3.7 (Installer 1.1.16), I use toml and bash instead for now :frowning:

1 Like

I noticed something more about the .ini files.

The block of text is only colored if I nest the block.
For example, considering this .md note:

## Properties file, or `ini`

```ini
[test]
a = b
```

## Inline

![[2025-02-10#Properties file, or `ini`]]

These block gets rendered like:

image

As you can see, there is no coloring on the first block of text, but there is color on the second one.

SYSTEM INFO:
	Obsidian version: v1.8.5
	Installer version: v1.8.4
	Operating system: Windows 10 Enterprise 10.0.19045
	Login status: logged in
	Language: en
	Catalyst license: insider
	Insider build toggle: on
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

(tested on my Vault and sandbox vault)

I noticed, it gets rendered correctly if the “Reading” mode is on.