obsidian-copilot icon indicating copy to clipboard operation
obsidian-copilot copied to clipboard

Unexpected Line Breaks in TOML Codeblocks in Reading View

Open hapenia opened this issue 10 months ago • 2 comments

When using the Obsidian Copilot plugin, TOML files displayed in Reading View exhibit unexpected line breaks. This issue disrupts the readability and formatting of TOML files, making it difficult to review or edit configurations.

Steps to Reproduce:

  1. Install and enable plugin in Obsidian.
  2. Write a toml codeblock.
  3. Switch to Reading View.
  4. Observe the unexpected line breaks in the TOML file content.

Expected Behavior:

Image

Actual Behavior:

Image

Environment:

  • Obsidian Version: 1.8.7
  • Copilot Version: 2.8.6
  • Operating System: Windows 11 and MacOS

hapenia avatar Feb 26 '25 13:02 hapenia

What do you mean, is this toml code block generated from the copilot view? Or is it something you wrote in your note? I don't see any relation to Copilot from your description.

logancyang avatar Feb 28 '25 23:02 logancyang

Or is it something you wrote in your note?

Here it is: @logancyang

https://github.com/user-attachments/assets/c82287f0-f611-43d5-bf9f-4df66ce7ac4d

hapenia avatar Mar 04 '25 07:03 hapenia

I have the same issue.

Only when Copilot plugin is enabled, all toml code blocks have this rendering issue. Code block generated by Copilot and code blocks written by the user. But only if they start with ```toml

To reproduce:

Create a new note, add this content:

```toml
[foo]
```

The issue does not appear with this:

```
[foo]
```

I guess it is related to "table", because [foo] is called a table in markdown.

Image

Image

You can see the issue appear/disappear when toggling Copilot plugin

alepez avatar May 30 '25 15:05 alepez

https://github.com/user-attachments/assets/8bf0ee5e-84ca-4e03-85a6-9606ea13a141

alepez avatar May 30 '25 16:05 alepez

The issue happens when Copilot generates toml too. If you ask gtp-4o "Print Cargo.toml example" it adds toml after the triple backticks under the hood: you do not see it, but it renders with the same issue. If you ask "Print Cargo.toml, do not specify toml in code block" it prints without syntax highlight and without the issue

alepez avatar May 30 '25 16:05 alepez

Image

alepez avatar May 30 '25 16:05 alepez

Image

alepez avatar May 30 '25 16:05 alepez

If I remove .table{display:table} from .obsidian/plugins/copilot/style.css, the issue is fixed.

Image

alepez avatar May 30 '25 16:05 alepez

This seems to be fixed by version 2.9.0, .table{display:table} is not in style.css and toml looks good.

Image

alepez avatar Jun 10 '25 15:06 alepez

Probably fixed by https://github.com/logancyang/obsidian-copilot/commit/972b63d002c15d7ae58b4155e0245c7451e4158d

alepez avatar Jun 10 '25 15:06 alepez

@logancyang I think this can be closed. After updating to 2.9.0 this issue is fixed.

2.8.9

Image

2.9.0

Image

alepez avatar Jun 10 '25 15:06 alepez