Hiding the blank line above tables

Obsidian recently updated their markdown spec to require a blank line before tables. I already try and avoid tables in Obsidian due to the poor interface, but this further compounds my dislike for them with how it negatively effects the visual appearance of my notes.

To help mitigate this I’ve created the following CSS to hide the blank line above tables. The blank line is still needed in the raw note, but this CSS will hide it within the live preview interface.

Simply add this code to your CSS Snippets folder, enable it, and the blank lines should now be hidden.

.cm-line:has(+ .cm-embed-block.cm-table-widget) br {
  display: none;
}
6 Likes

Thank you!!

Just here to add that you can remove the blank line with a different text editor and it works but your solution is much cleaner, thank you!

If you want to hide the padding and margin on the table too, you can use this.

.cm-embed-block.cm-table-widget.markdown-rendered {
    margin: 0;
    padding: 0;
}

.cm-line:has(+ .cm-embed-block.cm-table-widget) br {
    display: none;
}

This worked beautifully! Exactly what i needed.

Thank you @Samo! Your solution did the trick :slight_smile:

Was anyone able to hide the blank line below tables?