How to align markdown tables to the left, not columns but the TABLE itself

I’m becoming increasingly “fluent” in markdown tables, but one thing that still continues to elude me is how to align the table itself–not the columns, mind you, but the table as a whole–to the left edge of the document. For some reason, DEVONthink always center-aligns the table as a whole, and I find that irritating. Is there any way to fix it? Thanks!

The only possibility is to use a custom stylesheet for your Markdown documents, see e.g. Preferences > Files > Markdown.

Elaborating on @cgrunenberg reply, the CSS style for a “table” that probably will work is

table {
  float: left;

Change the default CSS file, or make your own.

I don’t have any markdown files in DEVONthink with tables to confirm that, but did test on an HTML file and worked.

There are a lot of CSS styles you can change to make your markdown files look as you want.

I’d advise against using float unless you really want to float elements around each other. It’s an untamed beast, causing a lot of trouble.
Rather try setting the margins and the padding.

In any case, I’d convert the MD to HTML and check, why the table is bit flush left. Then amend that setting.

1 Like

Good point. In my test this morning I didn’t see that when displayed in Safari, but I now see via Google search some admonitions about that. I did see some documentation about an “align” parameter for CSS tables, but that didn’t work. Did not pursue why. CSS can bend your mind sometimes.

Some more detail on this. DT uses its own, internal stylesheet for rendering Markdown as HTML. This is apparently dynamically generated: If I have an MD document containing only a table, only the styles relevant for tables are included.

Now, one could of course define one’s own stylesheet for MD documents globally, containing something like

table { margin: 1em };

which would effectively put the table to the left with a small margin. However (and this is a very bit however!): A global stylesheet (i.e. set in the preferences) for all MD documents overrides every default style. Every single one (and I don’t know the rationale for that). So it is probably a better choice to include a global stylesheet in each and every markdown file (which kind of goes against the whole idea of a global stylesheet, but there you are) like so

<link rel="stylesheet" href="x-devonthink-item://0841105D-70B7-4518-8E2C-68E25CF8FC38">

Alternatively, if you only want to change a small number of things, include the style verbatim at the top of the document like so

table { margin: 1em;}
1 Like

Thanks to all for the replies, and to @chrillek in particular. I’ve clearly got some experimenting/learning to do.