# \[Bug:\]Markdown: code block - empty line at end of block

**URL:** <https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224>\
**Category:** ℹ️ Support\
**Tags:** files-markdown-app\
**Created:** [April 30, 2021, 7:05pm UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224 "2021-04-30T19:05:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![herrdeh](https://help.nextcloud.com/letter_avatar/herrdeh/32/6_22734026db12803ebb3e059622ac3534.png) [@herrdeh](https://help.nextcloud.com/u/herrdeh)\
**Post date:** [April 30, 2021, 7:05pm UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/1 "2021-04-30T19:05:10Z")

</div>

Hello,  
I’m new to nextcloud, came over from OC and I’m really happy to be here!

Edit:  
This bug was already filed under [https://github.com/nextcloud/text/issues/150](https://github.com/nextcloud/text/issues/150). Thanks to @bb77 for the hint.

One petitesse:  
When I create a code block with three backticks before and behind the code, such as (screenshot from text editor):

![Bildschirmfoto von 2021-04-30 21-06-42](https://help.nextcloud.com/uploads/default/original/3X/9/9/9963f7078504f5f85f316d9caa96465e80ab3204.png)

it renders to a result with an empty line in the very end (screenshot from firefox when calling the file via the public link [https://nextcloud.rollentausch.eu/index.php/s/aYEabHB55N92fEb](https://nextcloud.rollentausch.eu/index.php/s/aYEabHB55N92fEb):  
 ![Bildschirmfoto von 2021-04-30 21-01-18](https://help.nextcloud.com/uploads/default/original/3X/0/3/036065980766cf03402dc0c3b390eb4d7d44bdb2.png)

Should I use another code - or is it “unexpected behaviour”? (-;

I’m using NC 20.0.7  
markdown editor (by Robin Appelman) 2.3.3  
files are edited in qownnotes 21.1.3 and synced to the server.

Cheers,  
Wolf

---

<div class="post-metadata">

**Author:** ![stefan-niedermann](https://help.nextcloud.com/user_avatar/help.nextcloud.com/stefan-niedermann/32/26974_2.png) [@stefan-niedermann](https://help.nextcloud.com/u/stefan-niedermann)\
**Post date:** [May 1, 2021, 5:27am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/2 "2021-05-01T05:27:58Z")

</div>

Hello and welcome to the community help forum! 🙂

We will try to help you, but without any information, we won’t be able to do so.

For example version information is missing completely. Also: Which app do you use? This is certainly not the shipped editor “Nextcloud Text” but looks more like [this one](https://apps.nextcloud.com/apps/files_markdown). Can you confirm this?

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 1, 2021, 7:42am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/3 "2021-05-01T07:42:44Z")

</div>

Hi @stefan-niedermann

I think the first screenshot in @herrdeh post is indeed the Markdown App from your link. But the second screenshot is from the Nextcloud Text app.

It does the same for me. If I open any Markdown file with the Nextcloud Text app, it always renders a blank line to end of the codeblocks. It doesn’t matter which app the file was created with. Even if you create the file with the Nextcloud Text App itself, empty lines will be renderd to codeblocks, every time you open the file again.

It has defenitly something to do with how the Nextcloud Text app renders these files. Because if you open the same file in any other markdown app, e.g. Nextcloud Notes, it gets renderd just fine, without any blank space at the end of the code blocks.

---

<div class="post-metadata">

**Author:** ![herrdeh](https://help.nextcloud.com/letter_avatar/herrdeh/32/6_22734026db12803ebb3e059622ac3534.png) [@herrdeh](https://help.nextcloud.com/u/herrdeh)\
**Post date:** [May 1, 2021, 8:01am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/4 "2021-05-01T08:01:37Z")

</div>

Sorry for making the same mistakes repeatedly, even after 25 years in IT… ):  
I tried to provide required info in the OP.

I tried the same code (characters, fenced by three backticks) in [https://dillinger.io/](https://dillinger.io/). There I do not find an empty line - that’s what I expected.

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 1, 2021, 8:21am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/5 "2021-05-01T08:21:34Z")

</div>

Steps to reproduce the issue:

1. Create a new markdown file with a codeblock inside the default Nextcloud Text app…

…and it’s gonna look something like this:

 ![Bildschirmfoto vom 2021-05-01 10-14-17](https://help.nextcloud.com/uploads/default/original/3X/d/7/d78ff793f47f5cb4b94283cc84190db7eb7c9be6.png)

1. Close the Text app with X in the upper right corner

2. Refresh the browser page

3. Open the file again…

…and it’s gonna look like this:

 ![Bildschirmfoto vom 2021-05-01 10-14-58](https://help.nextcloud.com/uploads/default/original/3X/0/e/0ecff083f5e404903fbdae581fe5d7f0cf46566e.png)

The same file in the Nextcloud Notes app looks like this:

 ![Bildschirmfoto vom 2021-05-01 10-27-54](https://help.nextcloud.com/uploads/default/original/3X/e/b/eba21fdf817c34e0d6fc69720685db569e693413.png)

…and in Discourse it looks like this: 😉

Das ist ein Testdokument

```auto
This is a code block

```

Tested this on Arch Linux in Firefox 88

It happens on my production server with Nextcloud 20.0.9 as well as on my testserver with Nextcloud 21.0.1

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 1, 2021, 8:53am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/6 "2021-05-01T08:53:45Z")

</div>

OK. I should have looked at GitHub first… 😉

There is already an issue on this topic:

[https://github.com/nextcloud/text/issues/150](https://github.com/nextcloud/text/issues/150)

…since 2019 😉

---

<div class="post-metadata">

**Author:** ![XueSheng-NC](https://help.nextcloud.com/letter_avatar/xuesheng-nc/32/6_22734026db12803ebb3e059622ac3534.png) [@XueSheng-NC](https://help.nextcloud.com/u/XueSheng-NC)\
**Post date:** [May 1, 2021, 9:22am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/7 "2021-05-01T09:22:50Z")

</div>

Depending on your textfile these empty lines even start to increase… thus you’ll see multiples empty lines after some time.  
Old issue which is kind of annoying if you really work with nextcloud text.

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 1, 2021, 9:49am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/8 "2021-05-01T09:49:41Z")

</div>

> [@XueSheng-NC](#):
>
> Old issue which is kind of annoying if you really work with nextcloud text.

Yep …and I don’t know why they have to reinvent the wheel, when there are so many working Markdown Editors already out there. But i’m not a developer and can therefore not really judge what is necessary to properly integrate such a function into an environment like Nextcloud.

---

<div class="post-metadata">

**Author:** ![stefan-niedermann](https://help.nextcloud.com/user_avatar/help.nextcloud.com/stefan-niedermann/32/26974_2.png) [@stefan-niedermann](https://help.nextcloud.com/u/stefan-niedermann)\
**Post date:** [May 1, 2021, 9:57am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/9 "2021-05-01T09:57:48Z")

</div>

> [@bb77](#):
>
> why they have to reinvent the wheel, when there are so many working Markdown Editors already out there.

They don’t. Nextcloud Text is based on ProseMirror markdown editor and adds just a few Nextcloud specific addidtions 😉

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 1, 2021, 10:10am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/10 "2021-05-01T10:10:31Z")

</div>

> [@stefan-niedermann](#):
>
> They don’t. Nextcloud Text is based on ProseMirror markdown editor

Ah ok. Thanks.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 13, 2024, 9:28am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/11 "2024-12-13T09:28:32Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 13, 2024, 9:28am UTC](https://help.nextcloud.com/t/bug-markdown-code-block-empty-line-at-end-of-block/115224/12 "2024-12-13T09:28:33Z")

</div>


