Folded content export to PDF hidden?

I’m trying to find a way to print to PDF, or some other printable format, the notes exactly as I set them up when I view them. I want the folded content to not be printed out when printing…

So far I have not been able to achieve anything

That is currently not possible. Printing does print the rendered markdown content of the note. The “fold” state information is not part of markdown, and is not stored inside the note itself. Implementing printing as folded would require changes in Obsidian, or a plugin. I am not aware of a plugin that does that.

1 Like

This is not exactly what you wanted, but when exporting to PDF using Pandoc, there’s a filter that can remove specific headings marked with {.noexport} from the resulting PDF:

See Limit what sections get exported/processed in Pandoc markdown? - Super User

Let know if you want to give it a shot, and I can help you with the setups steps, if needed.

that looks pretty complicated for what I need…
I couldn’t actually get Pandoc to work last time either, even though I installed it, set it up in the plugin path… it keeps giving me some error

Perhaps, but like vanadium said, I don’t think what you are asking is supported. What I suggested is a viable alternative that can hide certain sections in your exported PDFs.

I’m not a CSS wiz, but I tried implementing a CSS solution, but came up short.

This will hide folded headings in reading view:

.markdown-rendered .is-collapsed {
    display: none;

But when I tried to adapt it to the print PDF like so (and many other iterations) it wasn’t working:

@media print {
    .markdown-rendered .is-collapsed {
        display: none !important;

Perhaps someone will come along here and solve it. Otherwise, you could try the #appearance channel on Discord.

EDIT: I did more digging using the Print preview plugin, and it appears that classes like .is-collapsed are simply not present anymore in the CSS for the PDF print.

That’s why I offered to help with that. People sometimes have trouble setting up Pandoc. I assume you used the Pandoc plugin? I always advise people to avoid it, in favour of the Enhancing export plugin, since the Pandoc plugin is buggy and has been unmaintained for years.

After the setup, it’s only a matter of adding {.noexport} as needed, which you could insert using a template. But of course, a CSS solution would be ideal.

I used the Enhancing export plugin and installed Pandoc for Windows from the web… and I’ve linked it to the plugin… And it’s giving me a PDF error. Word expoert works

You can also copy from read mode and paste into any program that offers PDF export. Only visible content will be copied (i.e., only the bullets that are not collapsed). Also, things not shown in read mode by default (e.g., comments using %% twice) will not be contained in the copied content.
And the layout of the pasted content looks pretty good as well because it doesn‘t copy the markdown syntax but the formatted text.

1 Like