# %% Comment text blocks -- Unwanted extra lines in Reading Mode

**URL:** <https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280>\
**Category:** Bug reports\
**Tags:** comment, reading, repro\
**Created:** [April 18, 2023, 9:52pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280 "2023-04-18T21:52:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 9:52pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/1 "2023-04-18T21:52:31Z")

</div>

I have recently detected unwanted behaviour in Obsidian regarding the program’s way of handling reading view of text marked with `%%`. I don’t remember this happening before.

### Steps to reproduce

Type in normal text and text intended to be comments not visible for the public/reading mode. Type some more text below.

### Expected result

The two blocks of text that are not intended to be invisible should be one line apart.

### Actual result

The two blocks of text are some lines apart (probably the same amount as there were commented lines).

### Environment

Tried it only on Win 10, in the Sandbox vault with no plugins and themes activated.

* * *

### Additional information

I recorded my screen as well for good measure:  
 ![Obsidian_yRofdYbhPa](https://forum.obsidian.md/uploads/default/original/3X/2/e/2e8572418f8848ec91a0f166f2e48695f34d571a.gif)

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [April 18, 2023, 9:53pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/2 "2023-04-18T21:53:50Z")

</div>

what is the output of show debug info

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [April 18, 2023, 9:56pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/3 "2023-04-18T21:56:01Z")

</div>

Attach a copy of the file where this happens.

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:01pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/4 "2023-04-18T22:01:07Z")

</div>

SYSTEM INFO:  
Obsidian version: v1.1.16  
Installer version: v1.1.15  
Operating system: Windows 10 Home 10.0.19045  
Login status: not logged in  
Insider build toggle: off  
Live preview: on  
Legacy editor: off  
Base theme: dark  
Community theme: none  
Snippets enabled: 0  
Restricted mode: on

RECOMMENDATIONS:  
none

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:03pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/5 "2023-04-18T22:03:23Z")

</div>

[Untitled.md](https://forum.obsidian.md/uploads/short-url/ouqhpVfMhzhcBtubLlTfbNabfyy.md) (1.3 KB)

---

<div class="post-metadata">

**Author:** ![CawlinTeffid](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cawlinteffid/32/82899_2.png) [@CawlinTeffid](https://forum.obsidian.md/u/CawlinTeffid)\
**Post date:** [April 18, 2023, 10:22pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/6 "2023-04-18T22:22:53Z")

</div>

What happens if you put a blank line after the comment?

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:23pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/7 "2023-04-18T22:23:16Z")

</div>

If in Editor settings you enable **Strict line breaks** , the problem goes away.  
But I never remember having that option activated before and never experienced this issue before.

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:24pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/8 "2023-04-18T22:24:05Z")

</div>

Tried it before. Not helping.

---

<div class="post-metadata">

**Author:** ![CawlinTeffid](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cawlinteffid/32/82899_2.png) [@CawlinTeffid](https://forum.obsidian.md/u/CawlinTeffid)\
**Post date:** [April 18, 2023, 10:27pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/9 "2023-04-18T22:27:15Z")

</div>

I have strict line breaks turned off, and adding a blank line after the comment fixes the problem for me.

This shows a single blank line in Reading View, as it should:

```md
Ghjbghjkkhhj

%%Hgghjj%%

Vvdfghnn

```

This shows an extra blank line in Reading View, as you described:

```md
Ghjbghjkkhhj

%%Hgghjj%%
Vvdfghnn

```

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:30pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/10 "2023-04-18T22:30:21Z")

</div>

That indeed works.  
But I think the program handling this is not ideal the way it is.  
I have many many notes where I have multiple lines I decided to not publish and they are all lining up underneath each other with no empty lines. I could put some extra line there with regex of course, but still…

---

<div class="post-metadata">

**Author:** ![CawlinTeffid](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cawlinteffid/32/82899_2.png) [@CawlinTeffid](https://forum.obsidian.md/u/CawlinTeffid)\
**Post date:** [April 18, 2023, 10:38pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/11 "2023-04-18T22:38:44Z")

</div>

In general it’s a good idea to put blank lines between blocks in Markdown. Sometimes it’s required, and doing it the rest of the time keeps things consistent and avoids having to remember when it’s required and when it’s not.

But I agree, it looks like a bug. (I’m not the person who decides what’s a bug, tho.)

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:38pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/12 "2023-04-18T22:38:46Z")

</div>

The problem I had to start with was that you cannot include multiple lines with carriage returns and all with one %% pair in front and one at the end. You need to pair them off on each line.

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:40pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/13 "2023-04-18T22:40:36Z")

</div>

I’ll be looking out for this in the future and before I need to publish I will run some regexes to be safe.

---

<div class="post-metadata">

**Author:** ![CawlinTeffid](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cawlinteffid/32/82899_2.png) [@CawlinTeffid](https://forum.obsidian.md/u/CawlinTeffid)\
**Post date:** [April 18, 2023, 10:44pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/14 "2023-04-18T22:44:31Z")

</div>

Multiple lines inside a single set of comment markers works on my system. EDIT: And, strangely, doesn’t show the extra space problem.

This gives me a single blank line:

```auto
Vvdfghnn

%%Hjkk
Hdhfh
Hhj%%
Bhjj

```

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:47pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/15 "2023-04-18T22:47:06Z")

</div>

I seem to be remember so but other times it didn’t. I don’t know if it has to do with soft line breaks (I always have two spaces).

- Mind you, 99 percent of all comments were made with regexes, not as I typed.

By the way, [https://markdownlivepreview.com/](https://markdownlivepreview.com/) doesn’t handle this %% comment thingy at all. Don’t know about GitHub.

---

<div class="post-metadata">

**Author:** ![CawlinTeffid](https://forum.obsidian.md/user_avatar/forum.obsidian.md/cawlinteffid/32/82899_2.png) [@CawlinTeffid](https://forum.obsidian.md/u/CawlinTeffid)\
**Post date:** [April 18, 2023, 10:51pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/16 "2023-04-18T22:51:15Z")

</div>

That comment syntax is specific to Obsidian (in some usages it also works in Ulysses). `<!--HTML comments-->` are more widely compatible.

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:53pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/17 "2023-04-18T22:53:16Z")

</div>

It indeed works on multiple lines with soft line breaks.

But now I remember how it all happened: first I was using strikethroughs and then I decided that the reader should not see those deleted ideas (for fear of losing face). But because my strikethroughs were on multiple lines including lists (sometimes multiple lines deep), the structure of start and end was breaking and along with it, the comments as well.

Anyway, I hope it is treated as a bug, otherwise I need to manually oversee what behaviour needs attention.

---

<div class="post-metadata">

**Author:** ![zanodor](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/z/b5e925/32.png) [@zanodor](https://forum.obsidian.md/u/zanodor)\
**Post date:** [April 18, 2023, 10:58pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/18 "2023-04-18T22:58:31Z")

</div>

Indeed, I see it elsewhere online:  
“For maximum portability it is important to insert a blank line before and after […] comments.”

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [April 24, 2023, 2:30pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/19 "2023-04-24T14:30:17Z")

</div>

thanks

---

<div class="post-metadata">

**Author:** ![Ozen](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/o/ecae2f/32.png) [@Ozen](https://forum.obsidian.md/u/Ozen)\
**Post date:** [August 17, 2023, 5:22pm UTC](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280/20 "2023-08-17T17:22:54Z")

</div>

### Steps to reproduce

1. Add a heading
2. Add a comment to the following line
3. Add an internal link via `![[Note]]` to the following line

### Did you follow the [troubleshooting guide](https://forum.obsidian.md/t/about-the-bug-reports-category/24/10)? [Y]

Yes

### Expected result

There shouldn’t be extra space added between the heading and the inserted link. I’d expect comments to have no effect for the reading mode, but in this case, they do:  
if the comment is left out, there is no extra space.  
Expected:

 ![grafik](https://forum.obsidian.md/uploads/default/original/3X/d/b/dbc285dd0fb0ae50eb5b350a2cef82532e097b32.png)

### Actual result

 ![grafik](https://forum.obsidian.md/uploads/default/original/3X/d/6/d6a8514b22fe90e3cbe20df18bd62ae0d3ec47f4.png)

### Environment

SYSTEM INFO:  
Obsidian version: v1.3.7  
Installer version: v1.3.5  
Operating system: Windows 10 Pro 10.0.22621  
Login status: not logged in  
Insider build toggle: off  
Live preview: on  
Legacy editor: off  
Base theme: dark  
Community theme: none  
Snippets enabled: 0  
Restricted mode: off  
Plugins installed: 0  
Plugins enabled: 0

RECOMMENDATIONS:  
none

* * *

### Additional information

![Obsidian_23_08_17_q](https://forum.obsidian.md/uploads/default/original/3X/5/3/53a1859b4d750fa2d0caa08036f921325ad6aa4f.gif)

[Next page](https://forum.obsidian.md/t/comment-text-blocks-unwanted-extra-lines-in-reading-mode/58280.md?page=2)
