@@ -35,24 +35,24 @@ type Item struct {
3535 // inside a once-nested list, and so on. It matches the count of
3636 // *ast.ListItem ancestors in goldmark's tree.
3737 Level int
38- // Ordered reports whether the item belongs to an ordered list.
39- Ordered bool
4038 // Number is the literal ordered number written on the marker line
4139 // (ordered items only; 0 for bullets).
4240 Number int
43- // Marker is the marker byte: '-', '*', or '+' for bullets; '.' or
44- // ')' for ordered items.
45- Marker byte
41+ // Ordered reports whether the item belongs to an ordered list.
42+ Ordered bool
4643 // MultiBlock reports whether the item contains more than one block
4744 // child, matching goldmark's isMultiItem (ListItem.ChildCount > 1).
4845 MultiBlock bool
46+ // Marker is the marker byte: '-', '*', or '+' for bullets; '.' or
47+ // ')' for ordered items.
48+ Marker byte
4949}
5050
5151// List is one parsed list: a maximal run of sibling items at the same
5252// nesting level with the same ordered-ness.
5353type List struct {
54- // Ordered reports whether this is an ordered list .
55- Ordered bool
54+ // Items holds the list's direct child items in document order .
55+ Items [] Item
5656 // Start is the list's start value: for an ordered list, the literal
5757 // number of its first item (matching goldmark list.Start); 0 for an
5858 // unordered list.
@@ -65,10 +65,10 @@ type List struct {
6565 // LastLine is the 1-based source line of the list's last content
6666 // line (including continuation and nested-list lines).
6767 LastLine int
68+ // Ordered reports whether this is an ordered list.
69+ Ordered bool
6870 // TopLevel reports whether the list has no *ast.ListItem ancestor.
6971 TopLevel bool
70- // Items holds the list's direct child items in document order.
71- Items []Item
7272}
7373
7474// Parse scans lines and returns every list in document order plus a flat
@@ -111,6 +111,11 @@ type frame struct {
111111 // blockCount counts the item's block children, mirroring goldmark's
112112 // ChildCount used by isMultiItem.
113113 blockCount int
114+ // childListIndex is the index of the open child list nested directly
115+ // under this item, or -1 when none is open. It lets a following
116+ // nested marker rejoin the same child list instead of starting a new
117+ // one.
118+ childListIndex int
114119 // pendingBlank records a blank line seen while this item is open but
115120 // not yet followed by a continuation; it makes the next content line
116121 // start a new block child.
@@ -119,11 +124,6 @@ type frame struct {
119124 // item was paragraph text, so a following text line at lower indent
120125 // can lazily continue it.
121126 inParagraph bool
122- // childListIndex is the index of the open child list nested directly
123- // under this item, or -1 when none is open. It lets a following
124- // nested marker rejoin the same child list instead of starting a new
125- // one.
126- childListIndex int
127127 // emptyLine is true while the item has no recorded source line yet
128128 // (an empty marker line whose content has not arrived). The first
129129 // continuation line that attaches content sets the item's Line.
@@ -133,10 +133,10 @@ type frame struct {
133133type parser struct {
134134 lines [][]byte
135135 lists []List
136- // itemCount counts appended items for sizing the flat slice in Parse.
137- itemCount int
138136 // stack holds the currently open list items, outermost first.
139137 stack []frame
138+ // itemCount counts appended items for sizing the flat slice in Parse.
139+ itemCount int
140140 // blankRun counts consecutive blank lines pending before the current
141141 // line.
142142 blankRun int
@@ -360,10 +360,10 @@ func hasMarkerToken(line []byte, indent int) bool {
360360
361361// markerInfo describes a recognized list-item marker on a line.
362362type markerInfo struct {
363- ordered bool
364363 number int
365- marker byte
366364 contentCol int
365+ ordered bool
366+ marker byte
367367 // empty reports that the marker line carries no content after the
368368 // marker. goldmark gives such an item no source line of its own, so
369369 // its recorded Line is 0 until a continuation line attaches content;
0 commit comments