Trying to add a line before table header element in preview mode

(My apologies for the double post. I couldn’t edit or fully delete the other one.)

Right now I have to add an empty line between my last element and my table in order for it to render correctly in reading mode. I want it to render correctly in reading mode so it looks good when I export it to pdf.

And I’d prefer not to skip a line in editing mode so I can see as much content on the screen at once.

Unfortunately, I can’t figure out how to add the css to add a line before the table in reading mode.

So to clarify I want the table in reading mode to look like this:

  • (state 4 London normal etc. is the line above the table.)

But unfortunately it looks like this:

I thought the following code would add a line before the table header in reading mode, but it doesn’t.

.markdown-preview-view thead::before {
    content: "\a" !important;
    white-space: pre !important;

Interestingly, if I remove .markdown-preview-view then it adds a line before the table in editing mode (which I don’t want) but it still doesn’t work in preview mode.

So maybe thead isn’t an element in preview mode?

(Also, in case it’s relevant, I’m using the Advanced Tables community plugin.)

So I’m confused. I’d appreciate any help!

It seems like you want the syntax of going directly from a list item into a table, which possibly could be illegal markdown to render correctly?!

What happens when you make it legal with the line before the table? Why is that bad in your world?

I’ve confirmed that the table isn’t part of the list. It just comes after the list.

I’m fine with how it looks in reading mode with the line before the table. In editing mode, I think it seems too spacious with the extra line.

I spend most of my time in editing mode so It’d be nice if I could read as much content on my screen at the same time as possible.

I guess it then becomes a matter of personal preference, but it’s an easy choice for me to choose proper markdown versus an extra line.

If I should do something related to this I would rather hide the line in front of the table in source mode, rather than the other way around. And I’m not sure how to do that.

I’m also partial to thinking it looks better with some air before the table to keep it out of the continuous flow of text. Sorry, that I can’t be more helpful.

Yeah, I’d recommend trying to accept that Markdown involves some blank lines. It kind of bothered me at first but I’ve gotten used to it. They also make the structure of documents easier to parse at a glance.

If you want to hide (or probably better, shrink) the blank lines in editing mode, you might be able to do that with a CSS snippet, tho it may have unwanted side effects. There’s probably already a thread about it here somewhere, but if not, the Obsidian Discord’s #appearance channel is a good place to ask.

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