Is there a way to exclude a block from Presentation/Preview mode?

Does anyone know if there is a way to to exclude a block from Presentation/Preview mode using markdown? I’m new to the language and still trying to get my head around it.

Ideally it would go like this…


This block is included in Presentation mode


This block is not included in Presentation mode


You should be able to use CSS for this, I think. Set display: none; to a given type of content, perhaps using #hashtags and the tricks over here: How to give different colours to tags in the Tag Pane?

For instance, here’s a screenshot of the HTML for a demo slide. You should be able to select one of the two lines using e.g., .slides .section {and some selector like the tags idea above}

Screen Shot 2020-10-29 at 9.55.38 AM

I think you could also wrap the content you want to hide in html and target that in CSS

<span class="hide-this">This block is not included in Presentation mode</span>
.slides .hide-this, .markdown-preview-view .hide-this {
  display: none;
}
1 Like

Is there a way to do this with a more straightforward html tag, like for example

<meta> or <head>?

All of the note’s markdown content is being rendered within the <body> tag, so you couldn’t use <meta> or <head>. Could you give an example of how you would use those tags to solve this problem?

I’m trying to find a way to have what is essentially user-created metadata (i.e. tags, links) be visible with some css but not other css. I tried html comments but then they aren’t ever clickable.

Essentially, at the top of, say, my daily notes file, I like to have “Created using [[Template]]” so it’s linked to the Template in the graph view, but I don’t necessarily want to see that when I looked at the notes file.

Or, for example, if I have a piece of longform prose with the following information at the top:


alias: Civil Mage Chapter 03.1

Metadata

Outline

![[03.1 Refusal - Valentia]]

Header

Book: [[00 Civil Mage|Civil Mage]]
File Type: #Prose
Characters: [[IIrella]] [[Alem]] [[Valentia]] [[Dagrim]] [[Wanishtu]]
Setting: [[Oruku]]
Section: Refusal of the Call

Mentions

Characters: [[Eramepi]] [[Lupicin]]
Locations: [[Uskune]] [[Monche Prairie]]

Concepts Introduced

Notes

Chapter 03.1

I would love a way to set up “print” css to where I can wrap all of that in a tag of some kind and render it invisible some of the time, but the rest of the time actually be able to use those links for navigation, and also have the backlinks function.

Embeds are, in my opinion, an ugly workaround for this usecase because then I need to be working in multiple files and the links on the graph view don’t actually go to the correct file.

Yes, I understand what you are going for. Have you played around with “folding”? Obsidian now remembers if you’ve folded content under a heading so you can hide these sections. Check to see that you have folding turned on in Settings -> Editor.