How the hell to make the hidden text with three dots

I often see people hiding details of a post behind three dots that can be expanded to show the text hidden. How do you do that? The closest thing I could find was

[details="Summary"]
This text will be hidden
[/details]

But that shows up as a separate paragraph and with a little arrow. Like so

Summary

This text will be hidden

EDIT
I just realize now that there is a post about formatting that I should probably have read first :see_no_evil:

2 Likes

That’s a footnote.

Either you give it a number[^1] (or label[^foo]) and specify it elsewhere.

[^1]: This way, you can even have
    * multiple paragraph
    * and other stuff

    as long as stuff is indented.

    ```
    /// even code blocks can be useful
    fn main() {
        println!("Hello World!");
    }
    ```

Or you can have the footnote^[like this one] inline.

[^foo]: …

Either you give it a number[1] (or label[2]) and specify it elsewhere.

Or you can have the footnote[3] inline.


In this forum, markdown footnotes are rendered inline with the three dots. (Note that they won’t look this way in your preview, and other places like GitHub also render footnotes as actual footnotes, and might also not support the inline style.)


  1. This way, you can even have

    • multiple paragraph
    • and other stuff

    as long as stuff is indented.

    /// even code blocks can be useful
    fn main() {
        println!("Hello World!");
    }
    
    ↩︎
  2. ↩︎

  3. like this one ↩︎

9 Likes

I looked up how everyone can access other people’s posts’ markdown. Turns out, it’s possible. Use the “copy link” button to get a link to someone’s post like mine above

https://users.rust-lang.org/t/how-the-hell-to-make-the-hidden-text-with-three-dots/105501/2

then replace everything before the numbers with “raw

https://users.rust-lang.org/raw/105501/2

and there you can see it :wink:

8 Likes

That's great. One warning if you click on the "there" link from within the "installed" web app on mobile you won't be able to get back and will have to close the app.

EDIT
Nevermind, my phone was just horribly slow and there was no loading animation.

TIL: quadruple backticks for code block fences in code blocks

And as an experiment, I think I can demonstrate the above using quintuple backticks!

Here's an example of code block markdown syntax:
````
Start a code block with triple backticks:
```
fn main() {
# let _ = stringify! {
    ...
# };
}
```
And there you have it!
````
Pretty neat huh?

For fun I threw in how to get a nice ... function body in a (runnable) doctest.

Bit of a random tangent to a good question and a great answer!

1 Like

Indeed, you can always use more `s to escape fewer ones. This goes even for inline code blocks, so something like "backtick ` in here" would be written as ``"backtick ` in here"``, well or you could use html tags like <code>"backtick ` in here"</code>, though then inside of those, you might need to escape some characters, like other HTML tags. (These can also be useful for allowing links in inline code. E. g. if you want to individually link parts of an expression or type like in HashMap<i32, Vec<T>>.)

Multiline code blocks can also use ~~~ (which can then also nest the ``` delimited ones) so something like

```
fn hello_world() { todo!() }
```

can also be

~~~text
```
fn hello_world() { todo!() }
```
~~~

(I also generally find ~~~ a bit easier to type on a German keyboard so I started using it sometimes for faster typing of code blocks in general - and ease of typing is, I believe, the reason these exist to begin with)

Of course feel free to also inspect the source of this message itself.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.