vitaly-t
vitaly-t

Reputation: 25820

Hidden markdown text on GitHub

Is there anything in markdown syntax specifically on GitHub to support hidden text?

I just want to put some to-do notes in README.md for myself, not to be visible.


EXTRAS

As a tribute to the great answer by Tamas, and what's also asked a lot of times, below is an example of how to write foldable sections within MD files:

<details>
<summary><b>My section header in bold</b></summary>

Any folded content here. It requires an empty line just above it.

</details>

Upvotes: 91

Views: 70448

Answers (2)

JL Peyret
JL Peyret

Reputation: 12144

(This DOESN'T work on GitHub, which strips out CSS. But it can work in other Markdown viewers/editors. The reason I am adding it is because this question came up first when Googling hidden field markdown).

You can hide the field using CSS, if the rendering process respects it and doesn't strip it out:

Is this worth the hassle, as opposed to using an HTML comment? Probably not in most cases, though it does allow toggling visibility on and off.

#### hidden field with metadata 👇

<div class="meta_for_parser tablespecs" style="visibility:hidden">{"dataname":"environment","colvar":"varname","colval":"value"}</div>

#### hidden field with metadata 👆

glow a Rust-based terminal viewer

enter image description here

Typora, on macos

enter image description here

Macdown, on macos

enter image description here

But not GitHub

enter image description here

Upvotes: 8

user3151675
user3151675

Reputation: 58029

Just use standard HTML comments:

<!-- This is commented out. -->

Upvotes: 163

Related Questions