From a55e87e63dc5aa8f3d3cde775eb1bb9df65fd34f Mon Sep 17 00:00:00 2001 From: jessica parsons Date: Tue, 9 Jun 2026 12:07:54 -0700 Subject: [PATCH] add a 'section_break' flag into the line structure to keep the contents of adjacent blockquote chunks as separate blocks inside the blockquote --- basename.c | 2 +- markdown.c | 4 ++++ markdown.h | 1 + tests/codeblock.t | 12 ++++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/basename.c b/basename.c index 2a1d225..3ac4512 100644 --- a/basename.c +++ b/basename.c @@ -1,5 +1,5 @@ /* - * mkdio -- markdown front end input functions + * mkd_basename -- a url callback function that adds a prefix to an absolute path. * * Copyright (C) 2007 Jessica L Parsons. * The redistribution terms are provided in the COPYRIGHT file that must diff --git a/markdown.c b/markdown.c index 1fff940..0e2b615 100644 --- a/markdown.c +++ b/markdown.c @@ -684,6 +684,8 @@ fencedcodechunk(Line *first, mkd_flag_t *flags, int *yes) * past the closing fence */ for ( r = first->next; r; r = r->next ) { + if ( r->section_break ) + break; if ( iscodefence(r, first, flags) ) { if (S(first->text) - first->count > 0) { char *lang_attr = T(first->text) + first->count; @@ -856,6 +858,8 @@ quoteblock(Paragraph *p, mkd_flag_t *flags) t = q; break; } + if ( q != t->next ) + t->section_break = 1; } if ( isdivmarker(p->text,0,flags) ) { char *prefix = "class"; diff --git a/markdown.h b/markdown.h index ace005f..04d4af6 100644 --- a/markdown.h +++ b/markdown.h @@ -85,6 +85,7 @@ typedef struct line { int has_pipechar; /* line contains a | */ int is_checked; line_type kind; + int section_break; /* paragraph break in blockquote */ int is_fenced; /* line inside a fenced code block (ick) */ char *fence_class; /* fenced code class (ick) */ int count; diff --git a/tests/codeblock.t b/tests/codeblock.t index 16ea529..c2c184d 100644 --- a/tests/codeblock.t +++ b/tests/codeblock.t @@ -80,6 +80,18 @@ code ' +try -ffencedcode 'fenced code block in two adjacent blockquote chunks' \ +'>~~~~ +> not code + +> still not code +> ~~~~ ' \ +'

~~~~ +not code

+ +

still not code +~~~~

' + try -ffencedcode 'unterminated fenced code block' \ '~~~ code' \