commonmarker-merge 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md ADDED
@@ -0,0 +1,930 @@
1
+ | 📍 NOTE |
2
+ |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
3
+ | RubyGems (the [GitHub org][rubygems-org], not the website) [suffered][draper-security] a [hostile takeover][ellen-takeover] in September 2025. |
4
+ | Ultimately [4 maintainers][simi-removed] were [hard removed][martin-removed] and a reason has been given for only 1 of those, while 2 others resigned in protest. |
5
+ | It is a [complicated story][draper-takeover] which is difficult to [parse quickly][draper-lies]. |
6
+ | Simply put - there was active policy for adding or removing maintainers/owners of [rubygems][rubygems-maint-policy] and [bundler][bundler-maint-policy], and those [policies were not followed][policy-fail]. |
7
+ | I'm adding notes like this to gems because I [don't condone theft][draper-theft] of repositories or gems from their rightful owners. |
8
+ | If a similar theft happened with my repos/gems, I'd hope some would stand up for me. |
9
+ | Disenfranchised former-maintainers have started [gem.coop][gem-coop]. |
10
+ | Once available I will publish there exclusively; unless RubyCentral makes amends with the community. |
11
+ | The ["Technology for Humans: Joel Draper"][reinteractive-podcast] podcast episode by [reinteractive][reinteractive] is the most cogent summary I'm aware of. |
12
+ | See [here][gem-naming], [here][gem-coop] and [here][martin-ann] for more info on what comes next. |
13
+ | What I'm doing: A (WIP) proposal for [bundler/gem scopes][gem-scopes], and a (WIP) proposal for a federated [gem server][gem-server]. |
14
+
15
+ [rubygems-org]: https://github.com/rubygems/
16
+ [draper-security]: https://joel.drapper.me/p/ruby-central-security-measures/
17
+ [draper-takeover]: https://joel.drapper.me/p/ruby-central-takeover/
18
+ [ellen-takeover]: https://pup-e.com/blog/goodbye-rubygems/
19
+ [simi-removed]: https://www.reddit.com/r/ruby/s/gOk42POCaV
20
+ [martin-removed]: https://bsky.app/profile/martinemde.com/post/3m3occezxxs2q
21
+ [draper-lies]: https://joel.drapper.me/p/ruby-central-fact-check/
22
+ [draper-theft]: https://joel.drapper.me/p/ruby-central/
23
+ [reinteractive]: https://reinteractive.com/ruby-on-rails
24
+ [gem-coop]: https://gem.coop
25
+ [gem-naming]: https://github.com/gem-coop/gem.coop/issues/12
26
+ [martin-ann]: https://martinemde.com/2025/10/05/announcing-gem-coop.html
27
+ [gem-scopes]: https://github.com/galtzo-floss/bundle-namespace
28
+ [gem-server]: https://github.com/galtzo-floss/gem-server
29
+ [reinteractive-podcast]: https://youtu.be/_H4qbtC5qzU?si=BvuBU90R2wAqD2E6
30
+ [bundler-maint-policy]: https://github.com/ruby/rubygems/blob/b1ab33a3d52310a84d16b193991af07f5a6a07c0/doc/bundler/playbooks/TEAM_CHANGES.md
31
+ [rubygems-maint-policy]: https://github.com/ruby/rubygems/blob/b1ab33a3d52310a84d16b193991af07f5a6a07c0/doc/rubygems/POLICIES.md?plain=1#L187-L196
32
+ [policy-fail]: https://www.reddit.com/r/ruby/comments/1ove9vp/rubycentral_hates_this_one_fact/
33
+
34
+ [![Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0][🖼️galtzo-i]][🖼️galtzo-discord] [![ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5][🖼️ruby-lang-i]][🖼️ruby-lang] [![kettle-rb Logo by Aboling0, CC BY-SA 4.0][🖼️kettle-rb-i]][🖼️kettle-rb]
35
+
36
+ [🖼️galtzo-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg
37
+ [🖼️galtzo-discord]: https://discord.gg/3qme4XHNKN
38
+ [🖼️ruby-lang-i]: https://logos.galtzo.com/assets/images/ruby-lang/avatar-192px.svg
39
+ [🖼️ruby-lang]: https://www.ruby-lang.org/
40
+ [🖼️kettle-rb-i]: https://logos.galtzo.com/assets/images/kettle-rb/avatar-192px.svg
41
+ [🖼️kettle-rb]: https://github.com/kettle-rb
42
+
43
+ # ☯️ Commonmarker::Merge
44
+
45
+ [![Version][👽versioni]][commonmarker-merge-gem] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][commonmarker-merge-gem] [![Open Source Helpers][👽oss-helpi]][👽oss-help] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][commonmarker-merge-ci] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]
46
+
47
+ `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].
48
+
49
+ -----
50
+
51
+ `if ci_badges.map(&:color).all? { it == "green"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
52
+
53
+ [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
54
+
55
+ ## 🌻 Synopsis
56
+
57
+ `commonmarker-merge` is a thin wrapper around [markdown-merge][markdown-merge] that provides:
58
+
59
+ - **Hard dependency on Commonmarker** - Ensures the Comrak (Rust) parser is installed
60
+ - **Commonmarker-specific defaults** - Freeze token: `"commonmarker-merge"`, `inner_merge_code_blocks: false`
61
+ - **CommonMarker parse options** - Pass options via the `options:` parameter
62
+
63
+ ### Features (via markdown-merge)
64
+
65
+ - **Smart element matching** - Headings, paragraphs, lists, code blocks, and other block elements
66
+ are matched by their structural signatures
67
+ - **Fuzzy table matching** - Tables are matched using a multi-factor scoring algorithm that considers
68
+ header similarity, first column (row labels), content overlap, and position
69
+ - **Freeze blocks** - Mark sections with HTML comments to preserve them during merges
70
+ - **Configurable merge strategies** - Choose whether template or destination wins for conflicts,
71
+ or use a Hash for per-node-type preferences with `node_splitter` (see [ast-merge][ast-merge] docs)
72
+ - **Type normalization** - Canonical node types work across all markdown backends
73
+ - **Full CommonMarker support** - Works with all CommonMark and GitHub Flavored Markdown extensions
74
+
75
+ ### The `*-merge` Gem Family
76
+
77
+ The `*-merge` gem family provides intelligent, AST-based merging for various file formats. At the foundation is [tree_haver][tree_haver], which provides a unified cross-Ruby parsing API that works seamlessly across MRI, JRuby, and TruffleRuby.
78
+
79
+ | Gem | Version | CI | | Language<br>/ Format | Parser Backend(s) | Description |
80
+ |------------------------------------------|----------------------------------------------------------------|--------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|-------------|
81
+ | [tree_haver][tree_haver] | [![Version][tree_haver-gem-i]][tree_haver-gem] | [![Version][tree_haver-ci-i]][tree_haver-ci] | Multi | Supported Backends: MRI C, Rust, FFI, Java, Prism, Psych, Commonmarker, Markly, Citrus, Parslet | **Foundation**: Cross-Ruby adapter for parsing libraries (like Faraday for HTTP) |
82
+ | [ast-merge][ast-merge] | [![Version][ast-merge-gem-i]][ast-merge-gem] | [![Version][ast-merge-ci-i]][ast-merge-ci] | Text | internal | **Infrastructure**: Shared base classes and merge logic for all `*-merge` gems |
83
+ | [bash-merge][bash-merge] | [![Version][bash-merge-gem-i]][bash-merge-gem] | [![Version][bash-merge-ci-i]][bash-merge-ci] | Bash | [tree-sitter-bash][ts-bash] (via tree_haver) | Smart merge for Bash scripts |
84
+ | [commonmarker-merge][commonmarker-merge] | [![Version][commonmarker-merge-gem-i]][commonmarker-merge-gem] | [![Version][commonmarker-merge-ci-i]][commonmarker-merge-ci] | Markdown | [Commonmarker][commonmarker] (via tree_haver) | Smart merge for Markdown (CommonMark via comrak Rust) |
85
+ | [dotenv-merge][dotenv-merge] | [![Version][dotenv-merge-gem-i]][dotenv-merge-gem] | [![Version][dotenv-merge-ci-i]][dotenv-merge-ci] | Dotenv | internal | Smart merge for `.env` files |
86
+ | [json-merge][json-merge] | [![Version][json-merge-gem-i]][json-merge-gem] | [![Version][json-merge-ci-i]][json-merge-ci] | JSON | [tree-sitter-json][ts-json] (via tree_haver) | Smart merge for JSON files |
87
+ | [jsonc-merge][jsonc-merge] | [![Version][jsonc-merge-gem-i]][jsonc-merge-gem] | [![Version][jsonc-merge-ci-i]][jsonc-merge-ci] | JSONC | [tree-sitter-jsonc][ts-jsonc] (via tree_haver) | ⚠️ Proof of concept; Smart merge for JSON with Comments |
88
+ | [markdown-merge][markdown-merge] | [![Version][markdown-merge-gem-i]][markdown-merge-gem] | [![Version][markdown-merge-ci-i]][markdown-merge-ci] | Markdown | [Commonmarker][commonmarker] / [Markly][markly] (via tree_haver) | **Foundation**: Shared base for Markdown mergers with inner code block merging |
89
+ | [markly-merge][markly-merge] | [![Version][markly-merge-gem-i]][markly-merge-gem] | [![Version][markly-merge-ci-i]][markly-merge-ci] | Markdown | [Markly][markly] (via tree_haver) | Smart merge for Markdown (CommonMark via cmark-gfm C) |
90
+ | [prism-merge][prism-merge] | [![Version][prism-merge-gem-i]][prism-merge-gem] | [![Version][prism-merge-ci-i]][prism-merge-ci] | Ruby | [Prism][prism] (`prism` std lib gem) | Smart merge for Ruby source files |
91
+ | [psych-merge][psych-merge] | [![Version][psych-merge-gem-i]][psych-merge-gem] | [![Version][psych-merge-ci-i]][psych-merge-ci] | YAML | [Psych][psych] (`psych` std lib gem) | Smart merge for YAML files |
92
+ | [rbs-merge][rbs-merge] | [![Version][rbs-merge-gem-i]][rbs-merge-gem] | [![Version][rbs-merge-ci-i]][rbs-merge-ci] | RBS | [tree-sitter-bash][ts-rbs] (via tree_haver), [RBS][rbs] (`rbs` std lib gem) | Smart merge for Ruby type signatures |
93
+ | [toml-merge][toml-merge] | [![Version][toml-merge-gem-i]][toml-merge-gem] | [![Version][toml-merge-ci-i]][toml-merge-ci] | TOML | [Parslet + toml][toml], [Citrus + toml-rb][toml-rb], [tree-sitter-toml][ts-toml] (all via tree_haver) | Smart merge for TOML files |
94
+
95
+ #### Backend Platform Compatibility
96
+
97
+ tree_haver supports multiple parsing backends, but not all backends work on all Ruby platforms:
98
+
99
+ | Platform 👉️<br> TreeHaver Backend 👇️ | MRI | JRuby | TruffleRuby | Notes |
100
+ |-------------------------------------------------|:---:|:-----:|:-----------:|----------------------------------------------------------------------------|
101
+ | **MRI** ([ruby_tree_sitter][ruby_tree_sitter]) | ✅ | ❌ | ❌ | C extension, MRI only |
102
+ | **Rust** ([tree_stump][tree_stump]) | ✅ | ❌ | ❌ | Rust extension via magnus/rb-sys, MRI only |
103
+ | **FFI** ([ffi][ffi]) | ✅ | ✅ | ❌ | TruffleRuby's FFI doesn't support `STRUCT_BY_VALUE` |
104
+ | **Java** ([jtreesitter][jtreesitter]) | ❌ | ✅ | ❌ | JRuby only, requires grammar JARs |
105
+ | **Prism** ([prism][prism]) | ✅ | ✅ | ✅ | Ruby parsing, stdlib in Ruby 3.4+ |
106
+ | **Psych** ([psych][psych]) | ✅ | ✅ | ✅ | YAML parsing, stdlib |
107
+ | **Citrus** ([citrus][citrus]) | ✅ | ✅ | ✅ | Pure Ruby PEG parser, no native dependencies |
108
+ | **Parslet** ([parslet][parslet]) | ✅ | ✅ | ✅ | Pure Ruby PEG parser, no native dependencies |
109
+ | **Commonmarker** ([commonmarker][commonmarker]) | ✅ | ❌ | ❓ | Rust extension for Markdown (via [commonmarker-merge][commonmarker-merge]) |
110
+ | **Markly** ([markly][markly]) | ✅ | ❌ | ❓ | C extension for Markdown (via [markly-merge][markly-merge]) |
111
+
112
+ **Legend**: ✅ = Works, ❌ = Does not work, ❓ = Untested
113
+
114
+ **Why some backends don't work on certain platforms**:
115
+
116
+ - **JRuby**: Runs on the JVM; cannot load native C/Rust extensions (`.so` files)
117
+ - **TruffleRuby**: Has C API emulation via Sulong/LLVM, but it doesn't expose all MRI internals that native extensions require (e.g., `RBasic.flags`, `rb_gc_writebarrier`)
118
+ - **FFI on TruffleRuby**: TruffleRuby's FFI implementation doesn't support returning structs by value, which tree-sitter's C API requires
119
+
120
+ **Example implementations** for the gem templating use case:
121
+
122
+ | Gem | Purpose | Description |
123
+ |--------------------------|-----------------|-----------------------------------------------|
124
+ | [kettle-dev][kettle-dev] | Gem Development | Gem templating tool using `*-merge` gems |
125
+ | [kettle-jem][kettle-jem] | Gem Templating | Gem template library with smart merge support |
126
+
127
+ [tree_haver]: https://github.com/kettle-rb/tree_haver
128
+ [ast-merge]: https://github.com/kettle-rb/ast-merge
129
+ [prism-merge]: https://github.com/kettle-rb/prism-merge
130
+ [psych-merge]: https://github.com/kettle-rb/psych-merge
131
+ [json-merge]: https://github.com/kettle-rb/json-merge
132
+ [jsonc-merge]: https://github.com/kettle-rb/jsonc-merge
133
+ [bash-merge]: https://github.com/kettle-rb/bash-merge
134
+ [rbs-merge]: https://github.com/kettle-rb/rbs-merge
135
+ [dotenv-merge]: https://github.com/kettle-rb/dotenv-merge
136
+ [toml-merge]: https://github.com/kettle-rb/toml-merge
137
+ [markdown-merge]: https://github.com/kettle-rb/markdown-merge
138
+ [markly-merge]: https://github.com/kettle-rb/markly-merge
139
+ [commonmarker-merge]: https://github.com/kettle-rb/commonmarker-merge
140
+ [kettle-dev]: https://github.com/kettle-rb/kettle-dev
141
+ [kettle-jem]: https://github.com/kettle-rb/kettle-jem
142
+ [tree_haver-gem]: https://bestgems.org/gems/tree_haver
143
+ [ast-merge-gem]: https://bestgems.org/gems/ast-merge
144
+ [prism-merge-gem]: https://bestgems.org/gems/prism-merge
145
+ [psych-merge-gem]: https://bestgems.org/gems/psych-merge
146
+ [json-merge-gem]: https://bestgems.org/gems/json-merge
147
+ [jsonc-merge-gem]: https://bestgems.org/gems/jsonc-merge
148
+ [bash-merge-gem]: https://bestgems.org/gems/bash-merge
149
+ [rbs-merge-gem]: https://bestgems.org/gems/rbs-merge
150
+ [dotenv-merge-gem]: https://bestgems.org/gems/dotenv-merge
151
+ [toml-merge-gem]: https://bestgems.org/gems/toml-merge
152
+ [markdown-merge-gem]: https://bestgems.org/gems/markdown-merge
153
+ [markly-merge-gem]: https://bestgems.org/gems/markly-merge
154
+ [commonmarker-merge-gem]: https://bestgems.org/gems/commonmarker-merge
155
+ [kettle-dev-gem]: https://bestgems.org/gems/kettle-dev
156
+ [kettle-jem-gem]: https://bestgems.org/gems/kettle-jem
157
+ [tree_haver-gem-i]: https://img.shields.io/gem/v/tree_haver.svg
158
+ [ast-merge-gem-i]: https://img.shields.io/gem/v/ast-merge.svg
159
+ [prism-merge-gem-i]: https://img.shields.io/gem/v/prism-merge.svg
160
+ [psych-merge-gem-i]: https://img.shields.io/gem/v/psych-merge.svg
161
+ [json-merge-gem-i]: https://img.shields.io/gem/v/json-merge.svg
162
+ [jsonc-merge-gem-i]: https://img.shields.io/gem/v/jsonc-merge.svg
163
+ [bash-merge-gem-i]: https://img.shields.io/gem/v/bash-merge.svg
164
+ [rbs-merge-gem-i]: https://img.shields.io/gem/v/rbs-merge.svg
165
+ [dotenv-merge-gem-i]: https://img.shields.io/gem/v/dotenv-merge.svg
166
+ [toml-merge-gem-i]: https://img.shields.io/gem/v/toml-merge.svg
167
+ [markdown-merge-gem-i]: https://img.shields.io/gem/v/markdown-merge.svg
168
+ [markly-merge-gem-i]: https://img.shields.io/gem/v/markly-merge.svg
169
+ [commonmarker-merge-gem-i]: https://img.shields.io/gem/v/commonmarker-merge.svg
170
+ [kettle-dev-gem-i]: https://img.shields.io/gem/v/kettle-dev.svg
171
+ [kettle-jem-gem-i]: https://img.shields.io/gem/v/kettle-jem.svg
172
+ [tree_haver-ci-i]: https://github.com/kettle-rb/tree_haver/actions/workflows/current.yml/badge.svg
173
+ [ast-merge-ci-i]: https://github.com/kettle-rb/ast-merge/actions/workflows/current.yml/badge.svg
174
+ [prism-merge-ci-i]: https://github.com/kettle-rb/prism-merge/actions/workflows/current.yml/badge.svg
175
+ [psych-merge-ci-i]: https://github.com/kettle-rb/psych-merge/actions/workflows/current.yml/badge.svg
176
+ [json-merge-ci-i]: https://github.com/kettle-rb/json-merge/actions/workflows/current.yml/badge.svg
177
+ [jsonc-merge-ci-i]: https://github.com/kettle-rb/jsonc-merge/actions/workflows/current.yml/badge.svg
178
+ [bash-merge-ci-i]: https://github.com/kettle-rb/bash-merge/actions/workflows/current.yml/badge.svg
179
+ [rbs-merge-ci-i]: https://github.com/kettle-rb/rbs-merge/actions/workflows/current.yml/badge.svg
180
+ [dotenv-merge-ci-i]: https://github.com/kettle-rb/dotenv-merge/actions/workflows/current.yml/badge.svg
181
+ [toml-merge-ci-i]: https://github.com/kettle-rb/toml-merge/actions/workflows/current.yml/badge.svg
182
+ [markdown-merge-ci-i]: https://github.com/kettle-rb/markdown-merge/actions/workflows/current.yml/badge.svg
183
+ [markly-merge-ci-i]: https://github.com/kettle-rb/markly-merge/actions/workflows/current.yml/badge.svg
184
+ [commonmarker-merge-ci-i]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/current.yml/badge.svg
185
+ [kettle-dev-ci-i]: https://github.com/kettle-rb/kettle-dev/actions/workflows/current.yml/badge.svg
186
+ [kettle-jem-ci-i]: https://github.com/kettle-rb/kettle-jem/actions/workflows/current.yml/badge.svg
187
+ [tree_haver-ci]: https://github.com/kettle-rb/tree_haver/actions/workflows/current.yml
188
+ [ast-merge-ci]: https://github.com/kettle-rb/ast-merge/actions/workflows/current.yml
189
+ [prism-merge-ci]: https://github.com/kettle-rb/prism-merge/actions/workflows/current.yml
190
+ [psych-merge-ci]: https://github.com/kettle-rb/psych-merge/actions/workflows/current.yml
191
+ [json-merge-ci]: https://github.com/kettle-rb/json-merge/actions/workflows/current.yml
192
+ [jsonc-merge-ci]: https://github.com/kettle-rb/jsonc-merge/actions/workflows/current.yml
193
+ [bash-merge-ci]: https://github.com/kettle-rb/bash-merge/actions/workflows/current.yml
194
+ [rbs-merge-ci]: https://github.com/kettle-rb/rbs-merge/actions/workflows/current.yml
195
+ [dotenv-merge-ci]: https://github.com/kettle-rb/dotenv-merge/actions/workflows/current.yml
196
+ [toml-merge-ci]: https://github.com/kettle-rb/toml-merge/actions/workflows/current.yml
197
+ [markdown-merge-ci]: https://github.com/kettle-rb/markdown-merge/actions/workflows/current.yml
198
+ [markly-merge-ci]: https://github.com/kettle-rb/markly-merge/actions/workflows/current.yml
199
+ [commonmarker-merge-ci]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/current.yml
200
+ [kettle-dev-ci]: https://github.com/kettle-rb/kettle-dev/actions/workflows/current.yml
201
+ [kettle-jem-ci]: https://github.com/kettle-rb/kettle-jem/actions/workflows/current.yml
202
+ [prism]: https://github.com/ruby/prism
203
+ [psych]: https://github.com/ruby/psych
204
+ [ffi]: https://github.com/ffi/ffi
205
+ [ts-json]: https://github.com/tree-sitter/tree-sitter-json
206
+ [ts-jsonc]: https://gitlab.com/WhyNotHugo/tree-sitter-jsonc
207
+ [ts-bash]: https://github.com/tree-sitter/tree-sitter-bash
208
+ [ts-rbs]: https://github.com/joker1007/tree-sitter-rbs
209
+ [ts-toml]: https://github.com/tree-sitter-grammars/tree-sitter-toml
210
+ [dotenv]: https://github.com/bkeepers/dotenv
211
+ [rbs]: https://github.com/ruby/rbs
212
+ [toml-rb]: https://github.com/emancu/toml-rb
213
+ [toml]: https://github.com/jm/toml
214
+ [markly]: https://github.com/ioquatix/markly
215
+ [commonmarker]: https://github.com/gjtorikian/commonmarker
216
+ [ruby_tree_sitter]: https://github.com/Faveod/ruby-tree-sitter
217
+ [tree_stump]: https://github.com/joker1007/tree_stump
218
+ [jtreesitter]: https://central.sonatype.com/artifact/io.github.tree-sitter/jtreesitter
219
+ [citrus]: https://github.com/mjackson/citrus
220
+ [parslet]: https://github.com/kschiess/parslet
221
+
222
+ ## 💡 Info you can shake a stick at
223
+
224
+ | Tokens to Remember | [![Gem name][⛳️name-img]][commonmarker-merge-gem] [![Gem namespace][⛳️namespace-img]][commonmarker-merge] |
225
+ |-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
226
+ | Works with MRI Ruby 4 | [![Ruby 4.0 Compat][💎ruby-c-i]][commonmarker-merge-ci] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf] |
227
+ | Works with MRI Ruby 3 | [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎6-s-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎6-s-wf] [![Ruby 3.4 Compat][💎ruby-3.4i]][🚎6-s-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf] |
228
+ | Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Live Chat on Discord][✉️discord-invite-img-ftb]][🖼️galtzo-discord] [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork] [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor] |
229
+ | Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on Github.com][📜src-gh-img]][commonmarker-merge] [![The best SHA: dQw4w9WgXcQ\!][🧮kloc-img]][🧮kloc] |
230
+ | Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
231
+ | Compliance | [![License: MIT][📄license-img]][📄license-ref] [![Compatible with Apache Software Projects: Verified by SkyWalking Eyes][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img][📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
232
+ | Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
233
+ | Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼‍♂️devto-img]][💖💁🏼‍♂️devto] |
234
+ | `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼‍♂️aboutme-img]][💖💁🏼‍♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
235
+
236
+ ### Compatibility
237
+
238
+ Compatible with MRI Ruby 3.2.0+, and concordant releases of JRuby, and TruffleRuby.
239
+
240
+ | 🚚 *Amazing* test matrix was brought to you by | 🔎 appraisal2 🔎 and the color 💚 green 💚 |
241
+ |------------------------------------------------|--------------------------------------------------------|
242
+ | 👟 Check it out\! | ✨ [github.com/appraisal-rb/appraisal2][💎appraisal2] ✨ |
243
+
244
+ ### Federated DVCS
245
+
246
+ <details markdown="1">
247
+ <summary>Find this repo on federated forges (Coming soon!)</summary>
248
+
249
+ | Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
250
+ |---------------------------------------------------------|------------------------------------------------------------------------|----------------------------|---------------------------|----------------------------|---------------------------|--------------------------------|
251
+ | 🧪 [kettle-rb/commonmarker-merge on GitLab][📜src-gl] | The Truth | [💚][🤝gl-issues] | [💚][🤝gl-pulls] | [💚][📜gl-wiki] | 🐭 Tiny Matrix | ➖ |
252
+ | 🧊 [kettle-rb/commonmarker-merge on CodeBerg][📜src-cb] | An Ethical Mirror ([Donate][🤝cb-donate]) | [💚][🤝cb-issues] | [💚][🤝cb-pulls] | ➖ | ⭕️ No Matrix | ➖ |
253
+ | 🐙 [kettle-rb/commonmarker-merge on GitHub][📜src-gh] | Another Mirror | [💚][🤝gh-issues] | [💚][🤝gh-pulls] | [💚][📜gh-wiki] | 💯 Full Matrix | [💚][gh-discussions] |
254
+ | 🎮️ [Discord Server][🖼️galtzo-discord] | [![Live Chat on Discord][✉️discord-invite-img-ftb]][🖼️galtzo-discord] | [Let's][🖼️galtzo-discord] | [talk][🖼️galtzo-discord] | [about][🖼️galtzo-discord] | [this][🖼️galtzo-discord] | [library\!][🖼️galtzo-discord] |
255
+
256
+ </details>
257
+
258
+ [gh-discussions]: https://github.com/kettle-rb/commonmarker-merge/discussions
259
+
260
+ ### Enterprise Support [![Tidelift](https://tidelift.com/badges/package/rubygems/commonmarker-merge)][🏙️entsup-tidelift]
261
+
262
+ Available as part of the Tidelift Subscription.
263
+
264
+ <details markdown="1">
265
+ <summary>Need enterprise-level guarantees?</summary>
266
+
267
+ The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
268
+
269
+ [![Get help from me on Tidelift][🏙️entsup-tidelift-img]][🏙️entsup-tidelift]
270
+
271
+ - 💡Subscribe for support guarantees covering *all* your FLOSS dependencies
272
+ - 💡Tidelift is part of [Sonar][🏙️entsup-tidelift-sonar]
273
+ - 💡Tidelift pays maintainers to maintain the software you depend on\!<br/>📊`@`Pointy Haired Boss: An [enterprise support][🏙️entsup-tidelift] subscription is "[never gonna let you down][🧮kloc]", and *supports* open source maintainers
274
+
275
+ Alternatively:
276
+
277
+ - [![Live Chat on Discord][✉️discord-invite-img-ftb]][🖼️galtzo-discord]
278
+ - [![Get help from me on Upwork][👨🏼‍🏫expsup-upwork-img]][👨🏼‍🏫expsup-upwork]
279
+ - [![Get help from me on Codementor][👨🏼‍🏫expsup-codementor-img]][👨🏼‍🏫expsup-codementor]
280
+
281
+ </details>
282
+
283
+ ## ✨ Installation
284
+
285
+ Install the gem and add to the application's Gemfile by executing:
286
+
287
+ ```console
288
+ bundle add commonmarker-merge
289
+ ```
290
+
291
+ If bundler is not being used to manage dependencies, install the gem by executing:
292
+
293
+ ```console
294
+ gem install commonmarker-merge
295
+ ```
296
+
297
+ ### 🔒 Secure Installation
298
+
299
+ <details markdown="1">
300
+ <summary>For Medium or High Security Installations</summary>
301
+
302
+ This gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
303
+ [stone\_checksums][💎stone_checksums]. Be sure the gem you install hasn’t been tampered with
304
+ by following the instructions below.
305
+
306
+ Add my public key (if you haven’t already, expires 2045-04-29) as a trusted certificate:
307
+
308
+ ```console
309
+ gem cert --add <(curl -Ls https://raw.github.com/galtzo-floss/certs/main/pboling.pem)
310
+ ```
311
+
312
+ You only need to do that once. Then proceed to install with:
313
+
314
+ ```console
315
+ gem install commonmarker-merge -P HighSecurity
316
+ ```
317
+
318
+ The `HighSecurity` trust profile will verify signed gems, and not allow the installation of unsigned dependencies.
319
+
320
+ If you want to up your security game full-time:
321
+
322
+ ```console
323
+ bundle config set --global trust-policy MediumSecurity
324
+ ```
325
+
326
+ `MediumSecurity` instead of `HighSecurity` is necessary if not all the gems you use are signed.
327
+
328
+ NOTE: Be prepared to track down certs for signed gems and add them the same way you added mine.
329
+
330
+ </details>
331
+
332
+ ## ⚙️ Configuration
333
+
334
+ ### Freeze Blocks
335
+
336
+ Freeze blocks prevent sections from being modified during merges. They are marked
337
+ with HTML comments that are invisible when the Markdown is rendered:
338
+
339
+ ```markdown
340
+ <!-- commonmarker-merge:freeze -->
341
+ ## This Section Is Protected
342
+
343
+ Any content here will be preserved exactly as-is during merges.
344
+ The merge tool will not modify, replace, or remove this content.
345
+
346
+ <!-- commonmarker-merge:unfreeze -->
347
+ ```
348
+
349
+ You can add an optional reason to document why a section is frozen:
350
+
351
+ ```markdown
352
+ <!-- commonmarker-merge:freeze Manual TOC - do not auto-generate -->
353
+ ## Table of Contents
354
+ - [Installation](#installation)
355
+ - [Usage](#usage)
356
+ <!-- commonmarker-merge:unfreeze -->
357
+ ```
358
+
359
+ ### Custom Freeze Token
360
+
361
+ Use a custom freeze token if you need to avoid conflicts with other tools:
362
+
363
+ ```ruby
364
+ merger = Commonmarker::Merge::SmartMerger.new(
365
+ template,
366
+ destination,
367
+ freeze_token: "my-project",
368
+ )
369
+ # Now looks for: <!-- my-project:freeze --> and <!-- my-project:unfreeze -->
370
+ ```
371
+
372
+ ### Merge Preferences
373
+
374
+ Control how conflicts between template and destination are resolved:
375
+
376
+ ```ruby
377
+ # Preserve destination customizations (default)
378
+ merger = Commonmarker::Merge::SmartMerger.new(
379
+ template,
380
+ destination,
381
+ preference: :destination,
382
+ )
383
+
384
+ # Apply template updates (overwrite destination)
385
+ merger = Commonmarker::Merge::SmartMerger.new(
386
+ template,
387
+ destination,
388
+ preference: :template,
389
+ )
390
+
391
+ # Add new sections from template that don't exist in destination
392
+ merger = Commonmarker::Merge::SmartMerger.new(
393
+ template,
394
+ destination,
395
+ add_template_only_nodes: true,
396
+ )
397
+ ```
398
+
399
+ ### Debug Logging
400
+
401
+ Enable debug logging to see merge decisions:
402
+
403
+ ```bash
404
+ export COMMONMARKER_MERGE_DEBUG=1
405
+ ```
406
+
407
+ ### Table Match Refiner
408
+
409
+ When tables don't match by exact signature (identical headers), the `TableMatchRefiner`
410
+ uses fuzzy matching to pair tables that have:
411
+
412
+ - Similar headers (e.g., "Value" vs "Values")
413
+ - Similar first column content (row labels)
414
+ - Similar overall structure and content
415
+
416
+ <!-- end list -->
417
+
418
+ ```ruby
419
+ # Enable table fuzzy matching with custom threshold
420
+ merger = Commonmarker::Merge::SmartMerger.new(
421
+ template,
422
+ destination,
423
+ match_refiners: [
424
+ Commonmarker::Merge::TableMatchRefiner.new(threshold: 0.6),
425
+ ],
426
+ )
427
+ ```
428
+
429
+ #### TableMatchAlgorithm Weights
430
+
431
+ The `TableMatchAlgorithm` uses a multi-factor scoring system with configurable weights:
432
+
433
+ | Factor | Default Weight | Description |
434
+ |----------------|----------------|--------------------------------------------------------------|
435
+ | `header_match` | 0.25 | Percentage of matching header cells (Levenshtein similarity) |
436
+ | `first_column` | 0.20 | Percentage of matching first column cells |
437
+ | `row_content` | 0.25 | Average match percentage for rows with matching first column |
438
+ | `total_cells` | 0.15 | Overall cell matching percentage |
439
+ | `position` | 0.15 | Position distance (closer tables score higher) |
440
+
441
+ ```ruby
442
+ # Custom weights for specific use cases
443
+ refiner = Commonmarker::Merge::TableMatchRefiner.new(
444
+ threshold: 0.5,
445
+ algorithm_options: {
446
+ weights: {
447
+ header_match: 0.4, # Prioritize header matching
448
+ first_column: 0.2,
449
+ row_content: 0.2,
450
+ total_cells: 0.1,
451
+ position: 0.1,
452
+ },
453
+ },
454
+ )
455
+ ```
456
+
457
+ ## 🔧 Basic Usage
458
+
459
+ ### Merging Two Markdown Files
460
+
461
+ ```ruby
462
+ require "commonmarker/merge"
463
+
464
+ template_content = File.read("template.md")
465
+ dest_content = File.read("destination.md")
466
+
467
+ merger = Commonmarker::Merge::SmartMerger.new(template_content, dest_content)
468
+ result = merger.merge
469
+
470
+ if result.success?
471
+ File.write("destination.md", result.content)
472
+ puts "Merged successfully!"
473
+ puts " - Nodes added: #{result.nodes_added}"
474
+ puts " - Nodes modified: #{result.nodes_modified}"
475
+ puts " - Frozen blocks preserved: #{result.frozen_count}"
476
+ else
477
+ puts "Merge had conflicts:"
478
+ result.conflicts.each do |conflict|
479
+ puts " - #{conflict[:location]}: #{conflict[:reason]}"
480
+ end
481
+ end
482
+ ```
483
+
484
+ ### Analyzing a Markdown File
485
+
486
+ ```ruby
487
+ require "commonmarker/merge"
488
+
489
+ source = File.read("README.md")
490
+ analysis = Commonmarker::Merge::FileAnalysis.new(source)
491
+
492
+ # Iterate over all block elements
493
+ analysis.statements.each do |node|
494
+ case node
495
+ when Commonmarker::Merge::FreezeNode
496
+ puts "Freeze block: lines #{node.start_line}-#{node.end_line}"
497
+ puts " Reason: #{node.reason}" if node.reason
498
+ else
499
+ sig = analysis.generate_signature(node)
500
+ puts "#{node.type}: #{sig.inspect}"
501
+ end
502
+ end
503
+
504
+ # Get just the freeze blocks
505
+ analysis.freeze_blocks.each do |freeze_node|
506
+ puts "Protected: #{freeze_node.content[0..50]}..."
507
+ end
508
+ ```
509
+
510
+ ### Custom Signature Generator
511
+
512
+ Override how elements are matched between files:
513
+
514
+ ```ruby
515
+ # Match headings only by level, ignoring content
516
+ custom_sig = ->(node) {
517
+ if node.respond_to?(:type) && node.type == :heading
518
+ [:heading, node.header_level] # Match any h1 to any h1, etc.
519
+ else
520
+ node # Fall through to default signature
521
+ end
522
+ }
523
+
524
+ merger = Commonmarker::Merge::SmartMerger.new(
525
+ template,
526
+ destination,
527
+ signature_generator: custom_sig,
528
+ )
529
+ ```
530
+
531
+ ### Fuzzy Table Matching
532
+
533
+ When merging documents with tables that have been renamed or restructured,
534
+ use the `TableMatchRefiner` to find the best matches:
535
+
536
+ ```ruby
537
+ require "commonmarker/merge"
538
+
539
+ template = <<~MD
540
+ # API Reference
541
+
542
+ | Endpoint | Method | Description |
543
+ |----------|--------|-------------|
544
+ | /users | GET | List users |
545
+ | /users | POST | Create user |
546
+ MD
547
+
548
+ destination = <<~MD
549
+ # API Reference
550
+
551
+ | API Endpoint | HTTP Method | Descriptions |
552
+ |--------------|-------------|--------------|
553
+ | /users | GET | List users |
554
+ | /posts | GET | List posts |
555
+ MD
556
+
557
+ # Default merge won't match the tables (headers differ)
558
+ # Use TableMatchRefiner to enable fuzzy matching
559
+ merger = Commonmarker::Merge::SmartMerger.new(
560
+ template,
561
+ destination,
562
+ match_refiners: [
563
+ Commonmarker::Merge::TableMatchRefiner.new(threshold: 0.5),
564
+ ],
565
+ )
566
+ result = merger.merge
567
+
568
+ # Tables are now matched despite header differences
569
+ # ("Endpoint" ~ "API Endpoint", "Method" ~ "HTTP Method", etc.)
570
+ ```
571
+
572
+ ## 🦷 FLOSS Funding
573
+
574
+ While kettle-rb tools are free software and will always be, the project would benefit immensely from some funding.
575
+ Raising a monthly budget of... "dollars" would make the project more sustainable.
576
+
577
+ We welcome both individual and corporate sponsors\! We also offer a
578
+ wide array of funding channels to account for your preferences
579
+ (although currently [Open Collective][🖇osc] is our preferred funding platform).
580
+
581
+ **If you're working in a company that's making significant use of kettle-rb tools we'd
582
+ appreciate it if you suggest to your company to become a kettle-rb sponsor.**
583
+
584
+ You can support the development of kettle-rb tools via
585
+ [GitHub Sponsors][🖇sponsor],
586
+ [Liberapay][⛳liberapay],
587
+ [PayPal][🖇paypal],
588
+ [Open Collective][🖇osc]
589
+ and [Tidelift][🏙️entsup-tidelift].
590
+
591
+ | 📍 NOTE |
592
+ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
593
+ | If doing a sponsorship in the form of donation is problematic for your company <br/> from an accounting standpoint, we'd recommend the use of Tidelift, <br/> where you can get a support-like subscription instead. |
594
+
595
+ ### Open Collective for Individuals
596
+
597
+ Support us with a monthly donation and help us continue our activities. \[[Become a backer][🖇osc-backers]\]
598
+
599
+ NOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day, automatically.
600
+
601
+ <!-- OPENCOLLECTIVE-INDIVIDUALS:START -->
602
+ No backers yet. Be the first!
603
+ <!-- OPENCOLLECTIVE-INDIVIDUALS:END -->
604
+
605
+ ### Open Collective for Organizations
606
+
607
+ Become a sponsor and get your logo on our README on GitHub with a link to your site. \[[Become a sponsor][🖇osc-sponsors]\]
608
+
609
+ NOTE: [kettle-readme-backers][kettle-readme-backers] updates this list every day, automatically.
610
+
611
+ <!-- OPENCOLLECTIVE-ORGANIZATIONS:START -->
612
+ No sponsors yet. Be the first!
613
+ <!-- OPENCOLLECTIVE-ORGANIZATIONS:END -->
614
+
615
+ [kettle-readme-backers]: https://github.com/kettle-rb/commonmarker-merge/blob/main/exe/kettle-readme-backers
616
+
617
+ ### Another way to support open-source
618
+
619
+ I’m driven by a passion to foster a thriving open-source community – a space where people can tackle complex problems, no matter how small. Revitalizing libraries that have fallen into disrepair, and building new libraries focused on solving real-world challenges, are my passions. I was recently affected by layoffs, and the tech jobs market is unwelcoming. I’m reaching out here because your support would significantly aid my efforts to provide for my family, and my farm (11 🐔 chickens, 2 🐶 dogs, 3 🐰 rabbits, 8 🐈‍ cats).
620
+
621
+ If you work at a company that uses my work, please encourage them to support me as a corporate sponsor. My work on gems you use might show up in `bundle fund`.
622
+
623
+ I’m developing a new library, [floss\_funding][🖇floss-funding-gem], designed to empower open-source developers like myself to get paid for the work we do, in a sustainable way. Please give it a look.
624
+
625
+ **[Floss-Funding.dev][🖇floss-funding.dev]: 👉️ No network calls. 👉️ No tracking. 👉️ No oversight. 👉️ Minimal crypto hashing. 💡 Easily disabled nags**
626
+
627
+ [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate to my FLOSS efforts at ko-fi.com][🖇kofi-img]][🖇kofi] [![Donate to my FLOSS efforts using Patreon][🖇patreon-img]][🖇patreon]
628
+
629
+ ## 🔐 Security
630
+
631
+ See [SECURITY.md][🔐security].
632
+
633
+ ## 🤝 Contributing
634
+
635
+ If you need some ideas of where to help, you could work on adding more code coverage,
636
+ or if it is already 💯 (see [below](#code-coverage)) check [reek](REEK), [issues][🤝gh-issues], or [PRs][🤝gh-pulls],
637
+ or use the gem and think about how it could be better.
638
+
639
+ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
640
+
641
+ See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
642
+
643
+ ### 🚀 Release Instructions
644
+
645
+ See [CONTRIBUTING.md][🤝contributing].
646
+
647
+ ### Code Coverage
648
+
649
+ [![Coverage Graph][🏀codecov-g]][🏀codecov]
650
+
651
+ [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls]
652
+
653
+ [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov]
654
+
655
+ ### 🪇 Code of Conduct
656
+
657
+ Everyone interacting with this project's codebases, issue trackers,
658
+ chat rooms and mailing lists agrees to follow the [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct].
659
+
660
+ ## 🌈 Contributors
661
+
662
+ [![Contributors][🖐contributors-img]][🖐contributors]
663
+
664
+ Made with [contributors-img][🖐contrib-rocks].
665
+
666
+ Also see GitLab Contributors: <https://gitlab.com/kettle-rb/commonmarker-merge/-/graphs/main>
667
+
668
+ <details>
669
+ <summary>⭐️ Star History</summary>
670
+
671
+ <a href="https://star-history.com/#kettle-rb/commonmarker-merge&Date">
672
+ <picture>
673
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=kettle-rb/commonmarker-merge&type=Date&theme=dark" />
674
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=kettle-rb/commonmarker-merge&type=Date" />
675
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=kettle-rb/commonmarker-merge&type=Date" />
676
+ </picture>
677
+ </a>
678
+
679
+ </details>
680
+
681
+ ## 📌 Versioning
682
+
683
+ This Library adheres to [![Semantic Versioning 2.0.0][📌semver-img]][📌semver].
684
+ Violations of this scheme should be reported as bugs.
685
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
686
+ a new version should be immediately released that restores compatibility.
687
+ Breaking changes to the public API will only be introduced with new major versions.
688
+
689
+ > dropping support for a platform is both obviously and objectively a breaking change <br/>
690
+ > —Jordan Harband ([@ljharb](https://github.com/ljharb), maintainer of SemVer) [in SemVer issue 716][📌semver-breaking]
691
+
692
+ I understand that policy doesn't work universally ("exceptions to every rule\!"),
693
+ but it is the policy here.
694
+ As such, in many cases it is good to specify a dependency on this library using
695
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
696
+
697
+ For example:
698
+
699
+ ```ruby
700
+ spec.add_dependency("commonmarker-merge", "~> 1.0")
701
+ ```
702
+
703
+ <details markdown="1">
704
+ <summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
705
+
706
+ SemVer should, IMO, but doesn't explicitly, say that dropping support for specific Platforms
707
+ is a *breaking change* to an API, and for that reason the bike shedding is endless.
708
+
709
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
710
+ read this article from the creator of SemVer:
711
+
712
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
713
+
714
+ </details>
715
+
716
+ See [CHANGELOG.md][📌changelog] for a list of releases.
717
+
718
+ ## 📄 License
719
+
720
+ The gem is available as open source under the terms of
721
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref].
722
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
723
+
724
+ ### © Copyright
725
+
726
+ <ul>
727
+ <li>
728
+ Copyright (c) 2025 Peter H. Boling, of
729
+ <a href="https://discord.gg/3qme4XHNKN">
730
+ Galtzo.com
731
+ <picture>
732
+ <img src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px-blank.svg" alt="Galtzo.com Logo (Wordless) by Aboling0, CC BY-SA 4.0" width="24">
733
+ </picture>
734
+ </a>, and commonmarker-merge contributors.
735
+ </li>
736
+ </ul>
737
+
738
+ ## 🤑 A request for help
739
+
740
+ Maintainers have teeth and need to pay their dentists.
741
+ After getting laid off in an RIF in March, and encountering difficulty finding a new one,
742
+ I began spending most of my time building open source tools.
743
+ I'm hoping to be able to pay for my kids' health insurance this month,
744
+ so if you value the work I am doing, I need your support.
745
+ Please consider sponsoring me or the project.
746
+
747
+ To join the community or get help 👇️ Join the Discord.
748
+
749
+ [![Live Chat on Discord][✉️discord-invite-img-ftb]][🖼️galtzo-discord]
750
+
751
+ To say "thanks\!" ☝️ Join the Discord or 👇️ send money.
752
+
753
+ [![Sponsor kettle-rb/commonmarker-merge on Open Source Collective][🖇osc-all-bottom-img]][🖇osc] 💌 [![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal]
754
+
755
+ ### Please give the project a star ⭐ ♥.
756
+
757
+ Thanks for RTFM. ☺️
758
+
759
+ [⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
760
+ [⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
761
+ [⛳liberapay]: https://liberapay.com/pboling/donate
762
+ [🖇osc-all-img]: https://img.shields.io/opencollective/all/kettle-rb
763
+ [🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/kettle-rb
764
+ [🖇osc-backers-img]: https://img.shields.io/opencollective/backers/kettle-rb
765
+ [🖇osc-backers]: https://opencollective.com/kettle-rb#backer
766
+ [🖇osc-backers-i]: https://opencollective.com/kettle-rb/backers/badge.svg?style=flat
767
+ [🖇osc-sponsors]: https://opencollective.com/kettle-rb#sponsor
768
+ [🖇osc-sponsors-i]: https://opencollective.com/kettle-rb/sponsors/badge.svg?style=flat
769
+ [🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all/kettle-rb?style=for-the-badge
770
+ [🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors/kettle-rb?style=for-the-badge
771
+ [🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers/kettle-rb?style=for-the-badge
772
+ [🖇osc]: https://opencollective.com/kettle-rb
773
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
774
+ [🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
775
+ [🖇sponsor]: https://github.com/sponsors/pboling
776
+ [🖇polar-img]: https://img.shields.io/badge/polar-donate-a51611.svg?style=flat
777
+ [🖇polar]: https://polar.sh/pboling
778
+ [🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
779
+ [🖇kofi]: https://ko-fi.com/O5O86SNP4
780
+ [🖇patreon-img]: https://img.shields.io/badge/patreon-donate-a51611.svg?style=flat
781
+ [🖇patreon]: https://patreon.com/galtzo
782
+ [🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
783
+ [🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
784
+ [🖇buyme]: https://www.buymeacoffee.com/pboling
785
+ [🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
786
+ [🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&logo=paypal&color=0A0A0A
787
+ [🖇paypal]: https://www.paypal.com/paypalme/peterboling
788
+ [🖇floss-funding.dev]: https://floss-funding.dev
789
+ [🖇floss-funding-gem]: https://github.com/galtzo-floss/floss_funding
790
+ [✉️discord-invite]: https://discord.gg/3qme4XHNKN
791
+ [✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge&logo=discord
792
+ [✉️ruby-friends-img]: https://img.shields.io/badge/daily.dev-%F0%9F%92%8E_Ruby_Friends-0A0A0A?style=for-the-badge&logo=dailydotdev&logoColor=white
793
+ [✉️ruby-friends]: https://app.daily.dev/squads/rubyfriends
794
+ [✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
795
+ [⛳️gem-namespace]: https://github.com/kettle-rb/commonmarker-merge
796
+ [⛳️namespace-img]: https://img.shields.io/badge/namespace-Commonmarker::Merge-3C2D2D.svg?style=square&logo=ruby&logoColor=white
797
+ [⛳️gem-name]: https://bestgems.org/gems/commonmarker-merge
798
+ [⛳️name-img]: https://img.shields.io/badge/name-commonmarker--merge-3C2D2D.svg?style=square&logo=rubygems&logoColor=red
799
+ [⛳️tag-img]: https://img.shields.io/github/tag/kettle-rb/commonmarker-merge.svg
800
+ [⛳️tag]: http://github.com/kettle-rb/commonmarker-merge/releases
801
+ [🚂maint-blog]: http://www.railsbling.com/tags/commonmarker-merge
802
+ [🚂maint-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge&logo=rubyonrails&logoColor=orange
803
+ [🚂maint-contact]: http://www.railsbling.com/contact
804
+ [🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
805
+ [💖🖇linkedin]: http://www.linkedin.com/in/peterboling
806
+ [💖🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-LinkedIn-0B66C2?style=flat&logo=newjapanprowrestling
807
+ [💖✌️wellfound]: https://wellfound.com/u/peter-boling
808
+ [💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
809
+ [💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
810
+ [💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
811
+ [💖🐘ruby-mast]: https://ruby.social/@galtzo
812
+ [💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social&style=flat&logo=mastodon&label=Ruby%20@galtzo
813
+ [💖🦋bluesky]: https://bsky.app/profile/galtzo.com
814
+ [💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat&logo=bluesky&logoColor=white
815
+ [💖🌳linktree]: https://linktr.ee/galtzo
816
+ [💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat&logo=linktree
817
+ [💖💁🏼‍♂️devto]: https://dev.to/galtzo
818
+ [💖💁🏼‍♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat&logo=devdotto&logoColor=white
819
+ [💖💁🏼‍♂️aboutme]: https://about.me/peter.boling
820
+ [💖💁🏼‍♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat&logo=aboutme&logoColor=white
821
+ [💖🧊berg]: https://codeberg.org/pboling
822
+ [💖🐙hub]: https://github.org/pboling
823
+ [💖🛖hut]: https://sr.ht/~galtzo/
824
+ [💖🧪lab]: https://gitlab.com/pboling
825
+ [👨🏼‍🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
826
+ [👨🏼‍🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
827
+ [👨🏼‍🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
828
+ [👨🏼‍🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
829
+ [🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-commonmarker-merge?utm_source=rubygems-commonmarker-merge&utm_medium=referral&utm_campaign=readme
830
+ [🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
831
+ [🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
832
+ [💁🏼‍♂️peterboling]: http://www.peterboling.com
833
+ [🚂railsbling]: http://www.railsbling.com
834
+ [📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
835
+ [📜src-gl]: https://gitlab.com/kettle-rb/commonmarker-merge/
836
+ [📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge&logo=CodeBerg&logoColor=blue
837
+ [📜src-cb]: https://codeberg.org/kettle-rb/commonmarker-merge
838
+ [📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=Github&logoColor=green
839
+ [📜src-gh]: https://github.com/kettle-rb/commonmarker-merge
840
+ [📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
841
+ [📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
842
+ [📜gl-wiki]: https://gitlab.com/kettle-rb/commonmarker-merge/-/wikis/home
843
+ [📜gh-wiki]: https://github.com/kettle-rb/commonmarker-merge/wiki
844
+ [📜gl-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=gitlab&logoColor=white
845
+ [📜gh-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=github&logoColor=white
846
+ [👽dl-rank]: https://bestgems.org/gems/commonmarker-merge
847
+ [👽dl-ranki]: https://img.shields.io/gem/rd/commonmarker-merge.svg
848
+ [👽oss-help]: https://www.codetriage.com/kettle-rb/commonmarker-merge
849
+ [👽oss-helpi]: https://www.codetriage.com/kettle-rb/commonmarker-merge/badges/users.svg
850
+ [👽version]: https://bestgems.org/gems/commonmarker-merge
851
+ [👽versioni]: https://img.shields.io/gem/v/commonmarker-merge.svg
852
+ [🏀qlty-mnt]: https://qlty.sh/gh/kettle-rb/projects/commonmarker-merge
853
+ [🏀qlty-mnti]: https://qlty.sh/gh/kettle-rb/projects/commonmarker-merge/maintainability.svg
854
+ [🏀qlty-cov]: https://qlty.sh/gh/kettle-rb/projects/commonmarker-merge/metrics/code?sort=coverageRating
855
+ [🏀qlty-covi]: https://qlty.sh/gh/kettle-rb/projects/commonmarker-merge/coverage.svg
856
+ [🏀codecov]: https://codecov.io/gh/kettle-rb/commonmarker-merge
857
+ [🏀codecovi]: https://codecov.io/gh/kettle-rb/commonmarker-merge/graph/badge.svg
858
+ [🏀coveralls]: https://coveralls.io/github/kettle-rb/commonmarker-merge?branch=main
859
+ [🏀coveralls-img]: https://coveralls.io/repos/github/kettle-rb/commonmarker-merge/badge.svg?branch=main
860
+ [🖐codeQL]: https://github.com/kettle-rb/commonmarker-merge/security/code-scanning
861
+ [🖐codeQL-img]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/codeql-analysis.yml/badge.svg
862
+ [🚎2-cov-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/coverage.yml
863
+ [🚎2-cov-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/coverage.yml/badge.svg
864
+ [🚎3-hd-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/heads.yml
865
+ [🚎3-hd-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/heads.yml/badge.svg
866
+ [🚎5-st-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/style.yml
867
+ [🚎5-st-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/style.yml/badge.svg
868
+ [🚎6-s-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/supported.yml
869
+ [🚎6-s-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/supported.yml/badge.svg
870
+ [🚎11-c-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/current.yml
871
+ [🚎11-c-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/current.yml/badge.svg
872
+ [🚎12-crh-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/dep-heads.yml
873
+ [🚎12-crh-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/dep-heads.yml/badge.svg
874
+ [🚎13-🔒️-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/locked_deps.yml
875
+ [🚎13-🔒️-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/locked_deps.yml/badge.svg
876
+ [🚎14-🔓️-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/unlocked_deps.yml
877
+ [🚎14-🔓️-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/unlocked_deps.yml/badge.svg
878
+ [🚎15-🪪-wf]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/license-eye.yml
879
+ [🚎15-🪪-wfi]: https://github.com/kettle-rb/commonmarker-merge/actions/workflows/license-eye.yml/badge.svg
880
+ [💎ruby-3.2i]: https://img.shields.io/badge/Ruby-3.2-CC342D?style=for-the-badge&logo=ruby&logoColor=white
881
+ [💎ruby-3.3i]: https://img.shields.io/badge/Ruby-3.3-CC342D?style=for-the-badge&logo=ruby&logoColor=white
882
+ [💎ruby-3.4i]: https://img.shields.io/badge/Ruby-3.4-CC342D?style=for-the-badge&logo=ruby&logoColor=white
883
+ [💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
884
+ [💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
885
+ [🤝gh-issues]: https://github.com/kettle-rb/commonmarker-merge/issues
886
+ [🤝gh-pulls]: https://github.com/kettle-rb/commonmarker-merge/pulls
887
+ [🤝gl-issues]: https://gitlab.com/kettle-rb/commonmarker-merge/-/issues
888
+ [🤝gl-pulls]: https://gitlab.com/kettle-rb/commonmarker-merge/-/merge_requests
889
+ [🤝cb-issues]: https://codeberg.org/kettle-rb/commonmarker-merge/issues
890
+ [🤝cb-pulls]: https://codeberg.org/kettle-rb/commonmarker-merge/pulls
891
+ [🤝cb-donate]: https://donate.codeberg.org/
892
+ [🤝contributing]: CONTRIBUTING.md
893
+ [🏀codecov-g]: https://codecov.io/gh/kettle-rb/commonmarker-merge/graphs/tree.svg
894
+ [🖐contrib-rocks]: https://contrib.rocks
895
+ [🖐contributors]: https://github.com/kettle-rb/commonmarker-merge/graphs/contributors
896
+ [🖐contributors-img]: https://contrib.rocks/image?repo=kettle-rb/commonmarker-merge
897
+ [🚎contributors-gl]: https://gitlab.com/kettle-rb/commonmarker-merge/-/graphs/main
898
+ [🪇conduct]: CODE_OF_CONDUCT.md
899
+ [🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-259D6C.svg
900
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
901
+ [📌semver]: https://semver.org/spec/v2.0.0.html
902
+ [📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
903
+ [📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
904
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
905
+ [📌changelog]: CHANGELOG.md
906
+ [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
907
+ [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat
908
+ [📌gitmoji]: https://gitmoji.dev
909
+ [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
910
+ [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
911
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.178-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
912
+ [🔐security]: SECURITY.md
913
+ [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
914
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
915
+ [📄license]: LICENSE.txt
916
+ [📄license-ref]: https://opensource.org/licenses/MIT
917
+ [📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
918
+ [📄license-compat]: https://dev.to/galtzo/how-to-check-license-compatibility-41h0
919
+ [📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
920
+ [📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
921
+ [📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
922
+ [🚎yard-current]: http://rubydoc.info/gems/commonmarker-merge
923
+ [🚎yard-head]: https://commonmarker-merge.galtzo.com
924
+ [💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
925
+ [💎SHA_checksums]: https://gitlab.com/kettle-rb/commonmarker-merge/-/tree/main/checksums
926
+ [💎rlts]: https://github.com/rubocop-lts/rubocop-lts
927
+ [💎rlts-img]: https://img.shields.io/badge/code_style_&_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
928
+ [💎appraisal2]: https://github.com/appraisal-rb/appraisal2
929
+ [💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
930
+ [💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/