Nested preformatted text in Numbered List


(Nairolf) #1

It’s not possible to create a preformatted text nested in a numbered list.

Example:

  1. My first command

    $ echo hello


(Régis Hanol) #2

Or is it?

  1. My first command
    $ echo hello

And here’s how I did it

  1. My first command
    `$ echo hello`

(Jacob Chapel) #3
  1. Foo
    bar
  2. Fish
    food
1. Foo
`bar`
2. Fish
`food`

(Nairolf) #4

Oh, I just recognize there a two different ways to preformat text:

Variant A (using four blanks in front)

AND

Variant B (embrace with Grave accent)

So is it possible to use Variant A nested in a numbered list?


(Jacob Chapel) #5
  1. Foo
Bar
  1. Fish
Food

Doesn’t look like it.


(Kane York) #6

Use more indents.

  1. Foo

     Bar
    
  2. Fish

         Food
    
  3. https://meta.discourse.org/raw/24177/6


(Jacob Chapel) #7

There are some peculiarities of how it chooses to indent:

  1. Foo

     Bar
    
  2. Fish

Food
  1. Test
Are good

1st one above is using 8 space indent (with new line before and after). 2nd one is a typical triple backtick. 3rd is the same.

  1. Foo
Bar
  1. Fish

     Food
    
  2. Test

Are good

1st above is triple backtick. 2nd is 8 space indent. 3rd is triple backtick.


(Nairolf) #8

Perfect, 8 spaces did what I want! Thank you!