Menu

#412 Strange line block indentation (nested line blocks)

None
closed-works-for-me
nobody
None
2020-12-16
2020-12-08
No

I'm not sure this is indeed a bug, but this behavior really surprised me. The reStructuredText Markup Specification doesn't describe indentation in line blocks (nested line blocks). The attached screenshot illustrates the issue; left is the rst source, right is the rendered HTML (https://livesphinx.herokuapp.com/).

The indent level seems to be reset whenever a line with a lower indent level is inserted. That's the logic I've been able to deduce, but I think it just doesn't make sense.

I encountered this issue while working on a WYSIWYG editor. I cannot think of a proper way to add support for this behavior.

1 Attachments

Discussion

  • Brecht Machiels

    Brecht Machiels - 2020-12-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,5 @@
     I'm not sure this is indeed a bug, but this behavior really surprised me. The *reStructuredText Markup Specification* doesn't describe indentation in line blocks (nested line blocks). The attached screenshot illustrates the issue; left is the rst source, right is the rendered HTML (https://livesphinx.herokuapp.com/).
    
     The indent level seems to be reset whenever a line with a lower indent level is inserted. That's the logic I've been able to deduce, but I think it just doesn't make sense.
    +
    +I encountered this issue while working on a WYSIWYG editor. I cannot think of a proper way to add support for this behavior.
    
     
  • Günter Milde

    Günter Milde - 2020-12-09

    I'm not sure this is indeed a bug, but this behavior really surprised me.

    This is not a bug. (Generally, when encountering unexpected behaviour and the docs are unclear,
    the fist stop should be a question at docutils-users.)

    The doc is rather spare on details:

    Initial indents are also significant, resulting in a nested structure.
    

    The important point here is nested. Line blocks do not establish "tab stops".
    Looking at the (pseudo)xml output, you will see that the
    amount of the indentation is not stored, hence, when compiling

     | unindented line
     |   indented line
     | unindented line
     |       more indented line
     | unindented line
    

    the two indented lines will both be 1st-level nested line-blocks.

    The behaviour is the same as with nested quotes: just remove the trailing "| " from your example and test yourself.

    If you have an idea to improve the documentation, this is welcome.

     
  • Günter Milde

    Günter Milde - 2020-12-16
    • status: open --> closed-works-for-me
     

Log in to post a comment.

Monday.com Logo