markdig icon indicating copy to clipboard operation
markdig copied to clipboard

Nested lists of roman numerals that differ in casing fail to parse properly

Open manutiedra opened this issue 5 months ago • 2 comments

If I try to parse this:

1. **Introduction to Legal Principles**
   1) Historical Context
   2) Core Doctrines
      i. Doctrine of Precedent
      ii. Doctrine of Equity
   3) Sources of Law
2. **Civil Procedure**
   A) Pleadings and Motions
      a. The Complaint
      b. The Answer
      c. Pre-trial Motions
   B) Discovery Process
   C) Trial Proceedings

I get the proper AST:

Image

However, if I change the list before the roman numerals in lowercase to a list with roman numbers in uppercase like this:

1. **Introduction to Legal Principles**
   I) Historical Context
   II) Core Doctrines
      i. Doctrine of Precedent
      ii. Doctrine of Equity
   III) Sources of Law
2. **Civil Procedure**
   A) Pleadings and Motions
      a. The Complaint
      b. The Answer
      c. Pre-trial Motions
   B) Discovery Process
   C) Trial Proceedings

the AST generated is wrong, as it didn't create a third level for the list with lowercase roman numerals:

Image

manutiedra avatar Jul 19 '25 11:07 manutiedra

Hi, I was able to reproduce and dig into the issue a little bit, and I may have a solution.

Adding spaces for indentation before the third-level nested list element appears to resolve the issue. Specifically, I tried adding one extra space to the nested list items opening:

II) Core Doctrines
   i. Doctrine of Precedent
   ii. Doctrine of Equity

to:

II) Core Doctrines
  ->i. Doctrine of Precedent
  ->ii. Doctrine of Equity

Resulting in the following markdown input:

1. **Introduction to Legal Principles**
   I) Historical Context
   II) Core Doctrines
       i. Doctrine of Precedent
       ii. Doctrine of Equity
   III) Sources of Law
2. **Civil Procedure**
   A) Pleadings and Motions
      a. The Complaint
      b. The Answer
      c. Pre-trial Motions
   B) Discovery Process
   C) Trial Proceedings

From what I can gather, the normal indentation rules about nested lists are causing the issue, where there was not enough indentation away from the list item delimiter ) in the line II) Core Doctrines.

Does this help explain the unexpected behavior?

grc4kd avatar Oct 04 '25 18:10 grc4kd

Adding spaces for indentation before the third-level nested list element appears to resolve the issue. Specifically, I tried adding one extra space to the nested list items opening: Does this help explain the unexpected behavior?

Good catch. I missed this detail when reading the issue in the first place. Actually, this is not unexpected but part of the indentation rules for list items in the spec.

xoofx avatar Oct 05 '25 09:10 xoofx