Markdown files: Exporting to PDF or printing

Is there any good way to print a .md file from Seahub or exporting it to PDF, including inline images? I could live with the way Seahub renders it, but printing does not work (page won’t scroll).

Generating PDF from Markdown is on the roadmap for 7.1.

1 Like

I wanted to have that for myself so I created some quick & dirty CSS rules. Tested on FF only.

Create a custom.css file as described in the manual and add:

   /* Make Markdown printable */
@media print {

	.sf-md-viewer-topbar,
	.seafile-rich-editor-topbar {
		display: none;
	}

	.seafile-editor {
		position: inherit;
	}

	.seafile-editor-main,
	.seafile-editor-main-panel {
		display: block !important;
	}

	.editor {
		border: none;
		padding: 0;
	}

	.article table tr,
	.article table th {
		display: table-row;
	}

}
1 Like

Awesome, this works… somewhat. It breaks when displaying markdown tables* in print preview and seems to especially hate tables going across page borders.

Is there anything I can do about that? Thanks!

*these things:

| header1 | header2 |
| -----------| ----------- |
| stuff1.1  | stuff 2.1  |

I have added some rules for tables.

Cheers, looks slightly better now! Still has issue on page breaks though. I take it there’s not much more that can be done with just CSS is it?

Can you verify that the table rules

.article table tr,
.article table th {
	display: table-row;
}

are active? I have seen those crazy tables of yours before I added these rules.

I have tested them with different complex tables and they seem to work well for me. Otherwise please send a failing markdown file with test data, I will have a look.

1 Like

I did indeed not have those in my custom CSS. Something must have gone wrong during copy/paste. Everything looks good now, thanks!

Just one minor thing: is it possible somehow to “close” tables spanning page breaks properly? I.e. this is what it looks like currently:

Can the border at row “904” be closed by some CSS magic?