Welcome to little lamb

Code » qmdoc » commit 7c87ba5

Add support for our indent extension

author Olivier Brunel
2022-12-31 22:27:35 UTC
committer Olivier Brunel
2022-12-31 22:27:35 UTC
parent c6d756fcd604c8447d9f775942a463bdf0914205

Add support for our indent extension

main.c +12 -1
struct.css +3 -0

diff --git a/main.c b/main.c
index 968ebf3..77fd17c 100644
--- a/main.c
+++ b/main.c
@@ -368,6 +368,11 @@ enter_block(MD_BLOCKTYPE type, void *details, void *ctx_)
                 return ERR_PARSER_ENTER_BLOCK;
             break;
 
+        case MD_BLOCK_INDENT:
+            if (!raw_str(ctx, "<div class=\"indent\">"))
+                return ERR_PARSER_ENTER_BLOCK;
+            break;
+
         case MD_BLOCK_BOX:
             ;
             MD_BLOCK_BOX_DETAIL *d = details;
@@ -540,6 +545,11 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_)
                 return ERR_PARSER_LEAVE_BLOCK;
             break;
 
+        case MD_BLOCK_INDENT:
+            if (!raw_str(ctx, "</div>"))
+                return ERR_PARSER_LEAVE_BLOCK;
+            break;
+
         case MD_BLOCK_BOX:
             if (!raw_str(ctx, "</div>"))
                 return ERR_PARSER_LEAVE_BLOCK;
@@ -904,7 +914,8 @@ convert_page(struct ctx *ctx, int fddest)
     const MD_PARSER parser = {
         .flags = MD_FLAG_COLLAPSEWHITESPACE | MD_FLAG_PERMISSIVEAUTOLINKS
             | MD_FLAG_NOHTMLBLOCKS | MD_FLAG_STRIKETHROUGH | MD_FLAG_UNDERLINE
-            | MD_FLAG_ITALIC | MD_FLAG_BOLD | MD_FLAG_BOX | MD_FLAG_HIGHLIGHT,
+            | MD_FLAG_ITALIC | MD_FLAG_BOLD | MD_FLAG_BOX | MD_FLAG_HIGHLIGHT
+            | MD_FLAG_INDENT,
         .enter_block = enter_block,
         .leave_block = leave_block,
         .enter_span = enter_span,
diff --git a/struct.css b/struct.css
index 658cd1d..3beb5c1 100644
--- a/struct.css
+++ b/struct.css
@@ -181,6 +181,9 @@ main h6 {
 main blockquote {
     margin: 4px 23px 23px 42px;
 }
+main div.indent {
+    margin: -8px 23px 4px 42px;
+}
 main ul, main ol {
     padding-left: 42px;
 }