Live Preview rewrites a table in the file (pads its cells) when you only open or leave the note

Steps to reproduce

  1. Open a new, empty vault in the sandbox, so there are no community plugins. The editor’s default mode is Live Preview.

  2. Create two notes. a.md holds:

    | a | b |
    | - | - |
    | x | lorem |
    

    b.md holds anything, for example # b.

  3. Write both files from outside Obsidian, or with app.vault.create, so that neither one has been open in the editor yet.

  4. Open a.md. Do not click into it or type anything. Then open b.md in the same tab.

  5. Look at a.md on disk.

Did you follow the troubleshooting guide?

Yes. This is a fresh sandbox vault with no community plugins, so Advanced Tables is not installed.

Expected result

The file stays byte for byte as it was. Opening a note and then leaving it should not write to it.

Actual result

When I leave the note, a.md is written back with its table padded to the column widths. A modify event fires, and the modified time changes:

| a   | b     |
| --- | ----- |
| x   | lorem |

On some notes the write happens as soon as the note opens, before you leave it. That is the case when a math span or a fenced code block with a language comes after the table, anywhere later in the note, including inside a body cell:

| a | b |
| - | - |
| x | lorem |

$x$

A fence with no language does not trigger the write on open, and neither does math in the header row or math before the table. Source mode and Reading view never write the file.

The write also changes more than the spacing. When a body row has more cells than the header, the padding adds a header column for the extra cell. An unescaped wikilink alias therefore ends up split across two cells:

| a | b |
| - | - |
| [[target|alias]] | lorem |

After you leave the note, it is saved as:

| a        | b       |       |
| -------- | ------- | ----- |
| [[target | alias]] | lorem |

(I know the pipe should be escaped as \| inside a table. What surprised me is that just viewing the note changes how the table renders.)

Why this matters: just looking at a note changes the file. That shows up in git, sync and backup, and it moves the modified date, which “recently edited” lists and Dataview queries rely on. It also explains how some plugins read stale positions: a plugin that read the metadata cache before the note was opened gets offsets that no longer match the file once the table has been padded.

I could not find an existing report. The existing topics on table padding are about padding during edits, plus feature requests to turn it off.

Environment

  • Obsidian 1.14.5, installer 1.14.4, Windows 11
  • Fresh sandbox vault, no community plugins, default settings
1 Like