Skip to content

Commit

Permalink
Patch cmark to allow nested documents
Browse files Browse the repository at this point in the history
Patch taken from commonmark/cmark#522
  • Loading branch information
Ericson2314 committed Jan 17, 2024
1 parent 39f74ae commit f7f8874
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions dep-patches/cmark-allow-nested-documents.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/api_test/main.c b/api_test/main.c
index c2db737..9bc5748 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -456,6 +456,7 @@ void hierarchy(test_batch_runner *runner) {

int list_item_flag = 1 << CMARK_NODE_ITEM;
int top_level_blocks =
+ (1 << CMARK_NODE_DOCUMENT) |
(1 << CMARK_NODE_BLOCK_QUOTE) | (1 << CMARK_NODE_LIST) |
(1 << CMARK_NODE_CODE_BLOCK) | (1 << CMARK_NODE_HTML_BLOCK) |
(1 << CMARK_NODE_PARAGRAPH) | (1 << CMARK_NODE_HEADING) |
diff --git a/src/node.c b/src/node.c
index c90b0d4..64a4ed7 100644
--- a/src/node.c
+++ b/src/node.c
@@ -39,10 +39,6 @@ static bool S_can_contain(cmark_node *node, cmark_node *child) {
}
}

- if (child->type == CMARK_NODE_DOCUMENT) {
- return false;
- }
-
switch (node->type) {
case CMARK_NODE_DOCUMENT:
case CMARK_NODE_BLOCK_QUOTE:
12 changes: 10 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,17 @@
enableLargeConfig = true;
}).overrideAttrs(o: {
patches = (o.patches or []) ++ [
./boehmgc-coroutine-sp-fallback.diff
./dep-patches/boehmgc-coroutine-sp-fallback.diff

# https://github.com/ivmai/bdwgc/pull/586
./boehmgc-traceable_allocator-public.diff
./dep-patches/boehmgc-traceable_allocator-public.diff
];
});

cmark-nix = final.cmark.overrideAttrs (o: {
patches = (o.patches or []) ++ [
# https://github.com/commonmark/cmark/pull/522
./dep-patches/cmark-allow-nested-documents.diff
];
});

Expand All @@ -188,6 +195,7 @@
;
officialRelease = false;
boehmgc = final.boehmgc-nix;
cmark = final.cmark-nix;
libgit2 = final.libgit2-nix;
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;
changelog-d = final.changelog-d-nix;
Expand Down
1 change: 0 additions & 1 deletion package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ in {
./mk
(fileset.fileFilter (f: lib.strings.hasPrefix "nix-profile" f.name) ./scripts)
] ++ lib.optionals doBuild [
./boehmgc-coroutine-sp-fallback.diff
./doc
./misc
./precompiled-headers.h
Expand Down

0 comments on commit f7f8874

Please sign in to comment.