Hi,

attached are two patches for the cmark egg. I've submitted them to https://lists.sr.ht/~fancycade/public-inbox for lack of a better idea. If anybody knows of a better way to send patches to Harley Swick, please let me know.

Also, the egg builds fine on C6 so I guess it can be added to the coop.

Thanks,
Pietro

--
Pietro Cerutti
I have pledged to give 10% of income to effective charities
and invite you to join me - https://givingwhatwecan.org
From 1ae8cf584fb64e3c4cc8c7ce17757abd93da0aee Mon Sep 17 00:00:00 2001
From: Pietro Cerutti <[email protected]>
Date: Thu, 12 Mar 2026 13:27:56 +0000
Subject: [PATCH 1/2] Support HTML elements

---
 cmark.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmark.scm b/cmark.scm
index b01a429..6748bbf 100644
--- a/cmark.scm
+++ b/cmark.scm
@@ -412,7 +412,9 @@
        (= node-type CMARK_NODE_SOFTBREAK)
        (= node-type CMARK_NODE_CODE_BLOCK)
        (= node-type CMARK_NODE_THEMATIC_BREAK)
-       (= node-type CMARK_NODE_CODE)))
+       (= node-type CMARK_NODE_CODE)
+       (= node-type CMARK_NODE_HTML_BLOCK)
+       (= node-type CMARK_NODE_HTML_INLINE)))
 
  (define (update-stack stack node node-summary node-type head)
    (cond
@@ -602,6 +604,12 @@
         (node-stack-push! stack
                           (list 'blockquote vs))
         stack)]
+      [(= node-type CMARK_NODE_HTML_BLOCK)
+       (node-stack-push! stack (list 'literal (cmark-node-get-literal v)))
+       stack]
+      [(= node-type CMARK_NODE_HTML_INLINE)
+       (node-stack-push! stack (list 'literal (cmark-node-get-literal v)))
+       stack]
       [else stack])))
 
  (define (print-node-types nodes)
-- 
2.53.0

From a765c7e8f9c979a253ee27015b3e93205c9ef342 Mon Sep 17 00:00:00 2001
From: Pietro Cerutti <[email protected]>
Date: Thu, 12 Mar 2026 21:29:56 +0000
Subject: [PATCH 2/2] Use pkg-config to identify the correct cflags/ldflag for
 cmark

---
 cmark.egg      |  6 +++++-
 pkg-config.scm | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 pkg-config.scm

diff --git a/cmark.egg b/cmark.egg
index 5b98887..4af04ab 100644
--- a/cmark.egg
+++ b/cmark.egg
@@ -2,7 +2,11 @@
  (author "Harley Swick")
  (license "MIT")
  (category parsing)
- (components (extension cmark  (csc-options "-C" "-lcmark" "-L" "-lcmark")))
+ (components
+  (extension cmark
+   (cond-expand
+    (chicken-6 (csc-options (custom-config pkg-config.scm "libcmark")))
+    (else (csc-options "-C" "-lcmark" "-L" "-lcmark")))))
  (test-dependencies test lowdown)
  (foreign-dependencies cmark)
  )
diff --git a/pkg-config.scm b/pkg-config.scm
new file mode 100644
index 0000000..5468c05
--- /dev/null
+++ b/pkg-config.scm
@@ -0,0 +1,17 @@
+(import
+  (chicken format)
+  (chicken io)
+  (chicken process)
+  (chicken process-context)
+  (chicken string))
+
+(define package (car (command-line-arguments)))
+
+(define (pkg-config flag)
+  (with-input-from-pipe (sprintf "pkg-config ~A ~A" flag package) read-line))
+
+(define (write-opts csc-flag line)
+  (write (list csc-flag (intersperse (string-split line) csc-flag))))
+
+(write-opts "-C" (pkg-config "--cflags") )
+(write-opts "-L" (pkg-config "--libs"))
-- 
2.53.0

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to