question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Markdown no newlines in codeblock

See original GitHub issue

No matter what I try I cannot seem to get code blocks to show newlines. Additionally, it only seems possible to specify newlines in OSF’s markdown renderer in general by adding 2 spaces to the end of a line, but even that doesn’t work inside codeblocks.

The block displays fine of course if it contains no newlines. However something like this: ``` line 1
line 2
```

Will show up as: line 1 line 2

I’ve tried searching for different types of markdown syntax and trying just about every variant I can think of, and the block simply will not display newlines.

I can work around the issue by just making every single line of code its own block and adding 2 spaces to the end of each to achieve a newline, but this is rather tedious and looks very ugly.

If this is by design is there any chance it could be changed? There is already a feature for single line blocks using single quotes. In markdown triple quotes is supposed to be reserved for blocks that might contain newlines.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
TomBaxtercommented, Jun 27, 2017

Hello, sorry for the confusion. Here a link to the specific Doc.

In short, indent each line of the block by four spaces.

     This is
     a three
     line code block

This
is
not
4reactions
jpkeith4commented, Jun 28, 2017

Ok that simple file works, and after trying a few other things I think the issue is preceding the block by a bulleted line, or a non-bulleted line that is itself preceded by one.

For example, this doesn’t work:

- Bulleted line

    this code block
    doesn't work

But:

Non-bulleted line

    this code block
    works

and also, strangely enough:

- Bulleted line
Non-bulleted line

    this code block
    also doesn't work
Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown Line Breaks in Code Blocks - Stack Overflow
I've tried two spaces at the end of lines. Extra lines between code. Nothing seems to work. ```xml <?xml version="1.0" encoding="UTF ...
Read more >
Markdown Syntax | Hub - JetBrains
To format a code block in Markdown, indent every line of the block by at least four spaces. An indented code block cannot...
Read more >
Markdown fails to render code blocks with blank lines when ...
block contains blank lines (which is frequent in code) AND 2) code block is not separated from list by a blank line.
Read more >
How to add line breaks in code blocks - Atlassian Community
When you want to include a code block, press the Enter Key twice (making sure there is one space between your previous number...
Read more >
How can I properly embed a code block into a Markdown table ...
Here is a: Markdown table, with column spanning, ... Adding line breaks to a code block ... displays without the <br> as: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found