@@ -269,6 +269,26 @@ class ContentExample {
269269 url: '/#narrow/channel/378-api-design/topic/notation.20for.20near.20links/near/1972281' ,
270270 nodes: [TextNode ('#api design > notation for near links @ 💬' )]));
271271
272+ static const orderedListCustomStart = ContentExample (
273+ 'ordered list with custom start' ,
274+ '5. fifth\n 6. sixth' ,
275+ '<ol start="5">\n <li>fifth</li>\n <li>sixth</li>\n </ol>' ,
276+ [OrderedListNode (start: 5 , [
277+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('fifth' )])],
278+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('sixth' )])],
279+ ])],
280+ );
281+
282+ static const orderedListLargeStart = ContentExample (
283+ 'ordered list with large start number' ,
284+ '9999. first\n 10000. second' ,
285+ '<ol start="9999">\n <li>first</li>\n <li>second</li>\n </ol>' ,
286+ [OrderedListNode (start: 9999 , [
287+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
288+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('second' )])],
289+ ])],
290+ );
291+
272292 static const spoilerDefaultHeader = ContentExample (
273293 'spoiler with default header' ,
274294 '```spoiler\n hello world\n ```' ,
@@ -306,13 +326,13 @@ class ContentExample {
306326 '<p><em>italic</em> <a href="https://zulip.com/">zulip</a></p>\n '
307327 '</div></div>' ,
308328 [SpoilerNode (
309- header: [ListNode (ListStyle .ordered, [
310- [ListNode (ListStyle .unordered, [
311- [HeadingNode (level: HeadingLevel .h2, links: null , nodes: [
312- TextNode ('hello' ),
329+ header: [OrderedListNode (start: 1 , [[
330+ UnorderedListNode ([
331+ [HeadingNode (level: HeadingLevel .h2, links: null , nodes: [
332+ TextNode ('hello' ),
333+ ])]
313334 ])]
314335 ])],
315- ])],
316336 content: [ParagraphNode (links: null , nodes: [
317337 EmphasisNode (nodes: [TextNode ('italic' )]),
318338 TextNode (' ' ),
@@ -836,7 +856,7 @@ class ContentExample {
836856 '<div class="message_inline_image">'
837857 '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png">'
838858 '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div></li>\n </ul>' , [
839- ListNode ( ListStyle .unordered, [[
859+ UnorderedListNode ( [[
840860 ImageNodeList ([
841861 ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
842862 thumbnailUrl: null , loading: false ,
@@ -858,7 +878,7 @@ class ContentExample {
858878 '<div class="message_inline_image">'
859879 '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2" title="icon.png">'
860880 '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2"></a></div></li>\n </ul>' , [
861- ListNode ( ListStyle .unordered, [[
881+ UnorderedListNode ( [[
862882 ParagraphNode (wasImplicit: true , links: null , nodes: [
863883 LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
864884 TextNode (' ' ),
@@ -887,7 +907,7 @@ class ContentExample {
887907 '<a href="https://chat.zulip.org/user_avatars/2/realm/icon.png" title="icon.png">'
888908 '<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png"></a></div>'
889909 'more text</li>\n </ul>' , [
890- ListNode ( ListStyle .unordered, [[
910+ UnorderedListNode ( [[
891911 const ParagraphNode (wasImplicit: true , links: null , nodes: [
892912 LinkNode (url: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' , nodes: [TextNode ('icon.png' )]),
893913 TextNode (' ' ),
@@ -1559,16 +1579,16 @@ void main() {
15591579 testParse ('<ol>' ,
15601580 // "1. first\n2. then"
15611581 '<ol>\n <li>first</li>\n <li>then</li>\n </ol>' , const [
1562- ListNode ( ListStyle .ordered , [
1563- [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
1564- [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('then' )])],
1565- ]),
1582+ OrderedListNode (start : 1 , [
1583+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('first' )])],
1584+ [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('then' )])],
1585+ ]),
15661586 ]);
15671587
15681588 testParse ('<ul>' ,
15691589 // "* something\n* another"
15701590 '<ul>\n <li>something</li>\n <li>another</li>\n </ul>' , const [
1571- ListNode ( ListStyle .unordered, [
1591+ UnorderedListNode ( [
15721592 [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('something' )])],
15731593 [ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('another' )])],
15741594 ]),
@@ -1577,8 +1597,8 @@ void main() {
15771597 testParse ('implicit paragraph with internal <br>' ,
15781598 // "* a\n b"
15791599 '<ul>\n <li>a<br>\n b</li>\n </ul>' , const [
1580- ListNode ( ListStyle .unordered, [
1581- [ ParagraphNode (wasImplicit: true , links: null , nodes: [
1600+ UnorderedListNode ([ [
1601+ ParagraphNode (wasImplicit: true , links: null , nodes: [
15821602 TextNode ('a' ),
15831603 LineBreakInlineNode (),
15841604 TextNode ('\n b' ), // TODO: this renders misaligned
@@ -1589,13 +1609,15 @@ void main() {
15891609 testParse ('explicit paragraphs' ,
15901610 // "* a\n\n b"
15911611 '<ul>\n <li>\n <p>a</p>\n <p>b</p>\n </li>\n </ul>' , const [
1592- ListNode (ListStyle .unordered, [
1593- [
1612+ UnorderedListNode ([[
15941613 ParagraphNode (links: null , nodes: [TextNode ('a' )]),
15951614 ParagraphNode (links: null , nodes: [TextNode ('b' )]),
15961615 ],
15971616 ]),
15981617 ]);
1618+
1619+ testParseExample (ContentExample .orderedListCustomStart);
1620+ testParseExample (ContentExample .orderedListLargeStart);
15991621 });
16001622
16011623 testParseExample (ContentExample .spoilerDefaultHeader);
@@ -1628,7 +1650,7 @@ void main() {
16281650 testParse ('link in list item' ,
16291651 // "* [t](/u)"
16301652 '<ul>\n <li><a href="/u">t</a></li>\n </ul>' , const [
1631- ListNode ( ListStyle .unordered, [
1653+ UnorderedListNode ( [
16321654 [ParagraphNode (links: null , wasImplicit: true , nodes: [
16331655 LinkNode (url: '/u' , nodes: [TextNode ('t' )]),
16341656 ])],
@@ -1695,10 +1717,10 @@ void main() {
16951717 '<ol>\n <li>\n <blockquote>\n <h6>two</h6>\n <ul>\n <li>three</li>\n '
16961718 '</ul>\n </blockquote>\n <div class="codehilite"><pre><span></span>'
16971719 '<code>four\n </code></pre></div>\n\n </li>\n </ol>' , const [
1698- ListNode ( ListStyle .ordered , [[
1720+ OrderedListNode (start : 1 , [[
16991721 QuotationNode ([
17001722 HeadingNode (level: HeadingLevel .h6, links: null , nodes: [TextNode ('two' )]),
1701- ListNode ( ListStyle .unordered, [[
1723+ UnorderedListNode ( [[
17021724 ParagraphNode (wasImplicit: true , links: null , nodes: [TextNode ('three' )]),
17031725 ]]),
17041726 ]),
0 commit comments