@@ -48,14 +48,21 @@ public void setTight(boolean tight) {
4848 /**
4949 * Parse a list marker and return data on the marker or null.
5050 */
51- private static ListData parseListMarker (CharSequence line , final int markerIndex , final int markerColumn ) {
51+ private static ListData parseListMarker (CharSequence line , final int markerIndex , final int markerColumn ,
52+ final boolean inParagraph ) {
5253 CharSequence rest = line .subSequence (markerIndex , line .length ());
5354 Matcher matcher = MARKER .matcher (rest );
5455 if (!matcher .find ()) {
5556 return null ;
5657 }
5758
5859 ListBlock listBlock = createListBlock (matcher );
60+ if (inParagraph && listBlock instanceof OrderedList ) {
61+ // Ordered lists can only interrupt paragraphs with a start number of 1.
62+ if (((OrderedList ) listBlock ).getStartNumber () != 1 ) {
63+ return null ;
64+ }
65+ }
5966
6067 int markerLength = matcher .end () - matcher .start ();
6168 int indexAfterMarker = markerIndex + markerLength ;
@@ -129,8 +136,10 @@ public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockPar
129136 if (state .getIndent () >= Parsing .CODE_BLOCK_INDENT && !(matched instanceof ListBlockParser )) {
130137 return BlockStart .none ();
131138 }
132- int nextNonSpace = state .getNextNonSpaceIndex ();
133- ListData listData = parseListMarker (state .getLine (), nextNonSpace , state .getColumn () + state .getIndent ());
139+ int markerIndex = state .getNextNonSpaceIndex ();
140+ int markerColumn = state .getColumn () + state .getIndent ();
141+ ListData listData = parseListMarker (state .getLine (), markerIndex , markerColumn ,
142+ matchedBlockParser .getParagraphContent () != null );
134143 if (listData == null ) {
135144 return BlockStart .none ();
136145 }
0 commit comments