Welcome to little lamb

Code » qmdoc » commit ce2d85c

Add support of start number for <ol>

author Olivier Brunel
2023-01-12 19:47:35 UTC
committer Olivier Brunel
2023-01-12 19:47:35 UTC
parent 3515c225808ddd4ac07c19d9ab1c46c698248db3

Add support of start number for <ol>

src/main.c +12 -2

diff --git a/src/main.c b/src/main.c
index 3ff31db..608c11d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -495,8 +495,18 @@ enter_block(MD_BLOCKTYPE type, void *details, void *ctx_)
             break;
 
         case MD_BLOCK_OL:
-            if (!raw_str(ctx, "<ol>"))
-                return ERR_PARSER_ENTER_BLOCK;
+            {
+                MD_BLOCK_OL_DETAIL *d = details;
+                char buf[UINT32_FMT];
+                buf[uint32_fmt(buf, d->start)] = 0;
+
+                if (!raw_str(ctx, "<ol")
+                        || (d->start >= 0 && (!raw_str(ctx, " start=")
+                                              || !raw_str(ctx, buf))
+                           )
+                        || !raw_str(ctx, ">"))
+                    return ERR_PARSER_ENTER_BLOCK;
+            }
             break;
 
         case MD_BLOCK_LI: