Non-breaking spaces   are inserted above HTML tables in reading view

Steps to reproduce

  1. Enter the following text
  2. Swap to reading mode
  3. Open the Developer Tools (ctrl/cmd + shift + i) and inspect the div containing the HTML table
### HTML Table
<table>
  <tr>
    <th>Company</th>  
    <th >Contact</th>  
    <th>Country</th>  
  </tr>  
  <tr>  
    <td> Futterkiste</td>  
    <td>Maria Anders</td>  
    <td>Germany</td>  
  </tr>  
  <tr>  
    <td>Centro comercial Moctezuma</td>  
    <td>Francisco Chang</td>  
    <td>Mexico</td>  
  </tr>  
</table>

Expected result

The table should be directly beneath the H3 header

Actual result

There is a line of non-breaking space &nbsp; characters inserted above the table.

They appear correlated to the layout of the table as the number changes based on the breakdown of the table

Header with 3 rows

&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp; &nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;

Header with 2 rows

&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp; &nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;

Environment

Reproduced in a sandbox vault on Obsidian 1.2.7

SYSTEM INFO:
	Obsidian version: v1.2.7
	Installer version: v1.2.7
	Operating system: Windows 10 Education 10.0.19044
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

I can’t reproduce this.

Okay, I looked into it more and I think I see what’s happening. The website I copied the HTML code from used non-breaking spaces (nbs) instead of normal spaces for padding the start of lines. Obsidian apparently doesn’t handle this well.

It looks like the forums converted the nbs to normal spaces. Here is a pastebin that correctly reproduces the issue.

https://pastebin.com/raw/veSgvnqM

Ok, so if the nbsp are there, It’s not a bug.

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