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

Open
opened 2026-01-29 14:44:41 +00:00 by claunia · 2 comments
Owner

Originally created by @manutiedra on GitHub (Jul 19, 2025).

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
Originally created by @manutiedra on GitHub (Jul 19, 2025). 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: <img width="670" height="827" alt="Image" src="https://github.com/user-attachments/assets/6cdc2816-ea51-4234-a8c0-fbc61898f1f1" /> 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: <img width="607" height="842" alt="Image" src="https://github.com/user-attachments/assets/87f1180d-6bf6-4271-b5ff-0d50d6081a66" />
claunia added the question label 2026-01-29 14:44:41 +00:00
Author
Owner

@grc4kd commented on GitHub (Oct 4, 2025):

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 commented on GitHub (Oct 4, 2025): 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: ```markdown 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?
Author
Owner

@xoofx commented on GitHub (Oct 5, 2025):

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 commented on GitHub (Oct 5, 2025): > 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#747