Hiding certain callout blocks on print

I wanted to add my solution to this earlier issue, but it was closed with no replies. I find I need this feature often. I want to print my Obsidian notes for my students, but obviously my own “to do: photocopy this” isn’t useful for other people to see. Here’s what I’ve got – works, probably not optimal.

in my CSS:

@media print {
code, code[class*="language-ad-noprint"],
pre, pre[class*="language-ad-noprint"] {
    display: none !important;
  }
}

and in my Obsidian note:

```ad-noprint
This will not be printed.
```

I use the “ad-noprint” because I’m used to doing that for other blocks/formatting. You could probably use whatever custom name you like. Note that I do have the Admonition plugin (9.x) installed.

Hope it helps someone else, or they post a better method! :smiley:

1 Like

Works great. Thanks for sharing!

I moved this to Share & showcase.

1 Like