8

I posted a answer and below some list items the code content turned to other format different from what I was expecting. I tried to indent either by code button or manually but didn't work. Is It a UI bug or do I fail on format rules? In such cases, may I use other marks instead 4-spaces (ex:code tag)?

enter image description here

  • One more related issue: Why didn't the code inside a list move 8 spaces (instead 4) on button code pressing? The expect behavior in my opinion should be 8 spaces. – gwarah Jun 12 '16 at 20:27
16

The problem is the list. When using lists, you need to multiply the indentation by the list level (see this answer's source to understand better):

No list, 4 spaces indents code:

this is code
  • List item, you now need 8 spaces

    this is not code (4 spaces)

    this is code (8 spaces)
    
    • Sub-list item, you now need 12 spaces:

      this is not code (4 spaces)

      this is not code (8 spaces)

      this is code (12 spaces)
      
  • 1
    Thanks @terdon and askubuntu support team for the help and correction of the content. I suggest an example like this one in help format page. I believe this case could be a trick for newbie users. – gwarah Jun 12 '16 at 14:52
  • did you try to format these code contents by the code button {}? @terdon, as I could see, doesn't work for lists. So this interface functionality requires a maintenance or may disable the button in such cases IMHO. – gwarah Jun 15 '16 at 13:41
  • @gwarah you might be right. I suggest you post a bug report about this. Ask a new question here, tag it with "bug" and explain the issue. That way, the Stack Exchange developers can see it. – terdon Jun 15 '16 at 14:50
  • This is other issue I wasn't sure. In this question, I wrote in text :" Is It a UI bug or do I fail on format rules?". So I was wondering If this question with a new tag bugcould suppress the need of a new question. – gwarah Jun 15 '16 at 16:23
  • @gwarah not really. You would have to explain that the bug is the lack of documentation. – terdon Jun 15 '16 at 16:25
8

When your code is inside an ordered or unordered list you will need to indent it 8 spaces to get proper code formatting. I dunno if this is documented anywhere.

  • Thanks @Seth and team for the help and correction of the content. – gwarah Jun 12 '16 at 14:47
  • Ok @Seth, so the button code {} should also indent this content at 8 spaces. It isn't what happens. – gwarah Jun 15 '16 at 14:22
1

Minor note about 2 successive lists of different type even without any indent space.

- ul
1. il <-0 here notice

            |<-12 code

break

1. il
- ul <-0 here notice

            |<-12 code

  • ul

    1. il <-0 here notice

      |<-12 code
      

break

  1. il

    • ul <-0 here notice

      |<-12 code
      
  • 1
    these examples are quite didactic @Sneetsher, thanks. Did you try to do these with code button {} ? You'll see the format won't be as you post. This is the most important part of the question. Since the button doesn't exchange the content as visual code, or it's bugged or it would be disabled in lists to avoid incorrect formats. – gwarah Jun 15 '16 at 13:31
  • @gwarah, Yeah I crafted that by hand, you are right using buttons it won't let me. – user.dz Jun 17 '16 at 3:49

You must log in to answer this question.

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