7

There seems to be something wrong with the code formatting blocks.
It seems to be correctly working when done, like so:

Working!
     Definitely working.

But, when placed after a list (markdown first then result):

1. This is a list.
2. This is a second item in the list.

    This is some code formatted text.

Now, this is what it looks like:

  1. This is a list.
  2. This is a second item in the list.

    This is some code formatted text.

As you can see, it is not formatting correctly, and unlike quotes - There is no background... And the mono-spaced font (Courier New) is appearing like normal text (Arial).
Also, the space between the box and the start of the line is indeed an indent. (Not a bunch of spaces)

A quote has a background; shading, like so.


In case, this is what it looks like with the bug; formatting not done correctly (in case it's fixed and the above looks correct):

Markup isn't working after a list.


Edit: See this comment

Huh. Adding any text between the numbered list and the code-formatted text fixes it, so this definitely seems fishy. – StrixVaria♦

I tried completing the list. Also broke.

1. This is a list.
2. This is the second item.

    This should be preformatted text.

3. Now I've completed the list; closed it off around the coded text.
  1. This is a list.
  2. This is the second item.

    This should be preformatted text.

  3. Now I've completed the list; closed it off and around the coded text.

Still broken. (Backup image in case):

Broken still

4
  • Huh. Adding any text between the numbered list and the code-formatted text fixes it, so this definitely seems fishy.
    – Invader Skoodge Mod
    Commented Apr 21, 2015 at 13:16
  • @StrixVaria Odd. It's not working for me.
    – aytimothy
    Commented Apr 21, 2015 at 13:17
  • Oh, I believe this is implemented this way so that you can have multi-paragraph entries within a single numeric bullet. If you add another number after, it keeps counting up at 3.
    – Invader Skoodge Mod
    Commented Apr 21, 2015 at 13:18
  • When in doubt,  
    – fredley Mod
    Commented Apr 21, 2015 at 13:20

4 Answers 4

4

With the migration to CommonMark as of June 2020, you can now use three backticks to denote a code block. This more explicit format leaves no room for the renderer to have to guess whether your spacing is part of the list or part of a code block. For example:

Pre-formatted:

- List Item 1
```
This sits between 2 list items, but is not indented so it is not part of the list
```
- List Item 2
  ```
  This is indented, as it is part of List Item 2
  ```
```
  This is not a part of the list despite bumping right up against the previous code block
```

Result:

  • List Item 1
This sits between 2 list items, but is not indented so it is not part of the list
  • List Item 2
    This is indented, as it is part of List Item 2
    
  This is not a part of the list despite bumping right up against the previous code block
2

Solution One

1. This is a list.
2. This is a second item in the list.

If you put some text here...

    ...then this text renders fine.

  1. This is a list.
  2. This is a second item in the list.

If you put some text here...

...then this text renders fine.

You need actual paragraph text in between your list and your code text. This is because, without that, the spaces at the beginning of the line (since you're mid-list) are assumed to mean that you want a new paragraph within the current bullet, rather than code-formatted text.

Solution Two

1. This is a list.
2. This is a second item in the list.

        Here's some code-formatted text within a list.

  1. This is a list.
  2. This is a second item in the list.

    Here's some code-formatted text within a list.
    

To get this result, you just need to add a bunch more spaces until it works. This code-formatted text now counts as being within the bulleted list. If you really want top-level code-formatted text, you will need an interceding paragraph.

1
  • Waits 1 minute to accept. "You have to wait another minute."
    – aytimothy
    Commented Apr 21, 2015 at 13:29
2
* List Item
* List Item

 

    code block

  • List Item
  • List Item

 

code block
2
  • There's a bit of extra space, though.
    – fredley Mod
    Commented Apr 21, 2015 at 14:08
  • 2
    #90sWebHacksForLife
    – fredley Mod
    Commented Apr 21, 2015 at 14:09
1

In the case of crash dumps, I've found that adding a simple line break (---) is an elegant way to solve this issue, meaning this:

**System Info:**

- **Minecraft Version:** 1.6.4
- **Operating System:** Mac OS X (x86_64) version 10.7.5
- **Java Version:** 1.6.0_65, Apple Inc.

---
    ---- Minecraft Crash Report ----
    // Oops.

    Time: 4/19/15 5:58 PM

Becomes this:

System Info:

  • Minecraft Version: 1.6.4
  • Operating System: Mac OS X (x86_64) version 10.7.5
  • Java Version: 1.6.0_65, Apple Inc.

---- Minecraft Crash Report ----
// Oops.

Time: 4/19/15 5:58 PM

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .