stsewd/tree-sitter-rst

Title with bullet is parsed as a list followed by a transition

Closed this issue · 2 comments

As usual documenting an edge case that I encountered somewhere, not a request to fix, I'll try to send a fix upstream.

This

2) Intrinsic NumPy array creation functions
===========================================
..
  40 functions seems like a small number, but the routies.array-creation
  has ~47. I'm sure there are more. 


the ===== is seen as the title and .. as the underline I beleive.

Looks like the main problem is that the previous title is being parsed as a list followed by a transition instead of a title.

2) Intrinsic NumPy array creation functions
===========================================
enumerated_list [0, 0] - [0, 43]
  list_item [0, 0] - [0, 43]
    body [0, 3] - [0, 43]
      paragraph [0, 3] - [0, 43]
transition [1, 0] - [1, 43]

Without the number, it is parsed correctly

Intrinsic NumPy array creation functions
========================================
..
  40 functions seems like a small number, but the routies.array-creation
  has ~47. I'm sure there are more. 
section [0, 0] - [1, 40]
  title [0, 0] - [0, 40]
comment [2, 0] - [4, 35]

So, looks like for docutils this is invalid

  • test.rst:2: (WARNING/2) Enumerated list ends without a blank line; unexpected unindent.
2) Intrinsic NumPy array creation functions
3) Intrinsic NumPy array creation functions
===========================================
  • And this is a list followed by a transition (this case is already being parsed correctly)
1) Intrinsic NumPy array creation functions

===========================================

Next text

So, transitions require to be separated by a blank line (titles don't have this restriction)