commonmarker 2.9.0-x86_64-linux → 2.10.0-x86_64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3ae1bc65845718d6ad72f71749e19a1c79a03f3f595f7a99b51a65b1c74adb2
4
- data.tar.gz: b0931affda50f3e8d68f9478aaa867508e5971382ed38c95799403895a9a0b24
3
+ metadata.gz: 9ce6b951b17bb332437fd707359b206756948e4c71a1446aef9b2e1466622e43
4
+ data.tar.gz: 129ae692bbaa24696a7ef0900dad2cae399631e9d26f3f038eb900792b5ffce9
5
5
  SHA512:
6
- metadata.gz: df2ec5e2d2abefc34b2ce24aed16e15b73f2149113a52497d0f35c40d6482e96794a3637eb3ff1b6017cf42952ed00bbad290c32755c77ae0e3f350b58959313
7
- data.tar.gz: fffe876a0fd5fdae63d1650aafc266895a90e8144c38c14d977cb4f175f29d3b8840adec6fcda29d1b4ee7e44d9bfa99d755409ed622ead9de22535b6ca43dad
6
+ metadata.gz: 71fde760c2ac2d8035b0090e7b0270e1f0147bc66d5a05b157a54248b630107ac0e299453fed9fa2269d6c1be97ade2788f40790e15c0b77cf8d837b70795ffa
7
+ data.tar.gz: 0b3c60142ac4e0b9440c4a08f3ed7fde610f27615438b638eb98349142df89dbaf51b62a4faae051cf176f54b93b7bce28893ee94ed12a00fc04eaca827434dd
data/README.md CHANGED
@@ -140,6 +140,24 @@ doc.to_commonmark
140
140
  # => # The site\n\nGitHub\n
141
141
  ```
142
142
 
143
+ ### Reading and writing node content
144
+
145
+ `string_content` reads and writes the text of nodes whose content is plain text (like `:text`, `:code`, and `:code_block`).
146
+
147
+ `literal` reads and writes the raw string a node carries, for every node type that has one (like `:text`, `:code`, `:code_block`, `:html_block`, `:html_inline`, `:raw`, `:math`, and `:frontmatter`).
148
+
149
+ The two exist separately because they mean different things. Rewriting `string_content` only ever swaps text for text. Rewriting `literal` on an `:html_block`, `:html_inline`, or `:raw` node writes markup that is emitted unescaped:
150
+
151
+ ```ruby
152
+ doc = Commonmarker.parse("A <b>bold</b> claim")
153
+
154
+ doc.walk do |node|
155
+ node.literal = "<i>" if node.type == :html_inline && node.literal == "<b>"
156
+ end
157
+ ```
158
+
159
+ Note that a `:frontmatter` node's literal includes its delimiters and trailing newlines, so anything you assign must include them too.
160
+
143
161
  ## Options and plugins
144
162
 
145
163
  ### Options
@@ -169,21 +187,21 @@ Note that there is a distinction in comrak for "parse" options and "render" opti
169
187
 
170
188
  ### Render options
171
189
 
172
- | Name | Description | Default |
173
- | -------------------- | ------------------------------------------------------------------------------------------------------ | ------- |
174
- | `hardbreaks` | [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) translate into hard line breaks. | `true` |
175
- | `github_pre_lang` | GitHub-style `<pre lang="xyz">` is used for fenced code blocks with info tags. | `true` |
176
- | `full_info_string` | Gives info string data after a space in a `data-meta` attribute on code blocks. | `false` |
177
- | `width` | The wrap column when outputting CommonMark. | `80` |
178
- | `unsafe` | Allow rendering of raw HTML and potentially dangerous links. | `false` |
179
- | `escape` | Escape raw HTML instead of clobbering it. | `false` |
180
- | `sourcepos` | Include source position attribute in HTML and XML output. | `false` |
181
- | `escaped_char_spans` | Wrap escaped characters in span tags. | `true` |
182
- | `ignore_empty_links` | Ignores empty links, leaving the Markdown text in place. | `false` |
183
- | `gfm_quirks` | Outputs HTML with GFM-style quirks; namely, not nesting `<strong>` inlines. | `false` |
184
- | `prefer_fenced` | Always output fenced code blocks, even where an indented one could be used. | `false` |
185
- | `tasklist_classes` | Add CSS classes to the HTML output of the tasklist extension | `false` |
186
- | `compact_html` | Suppress newlines in pretty-printed HTML output. | `false` |
190
+ | Name | Description | Default |
191
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------ |
192
+ | `hardbreaks` | [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) translate into hard line breaks. | `true` |
193
+ | `github_pre_lang` | GitHub-style `<pre lang="xyz">` is used for fenced code blocks with info tags. | `true` |
194
+ | `full_info_string` | Gives info string data after a space in a `data-meta` attribute on code blocks. | `false` |
195
+ | `width` | The wrap column when outputting CommonMark. | `80` |
196
+ | `unsafe` | Allow rendering of raw HTML and potentially dangerous links. | `false` |
197
+ | `escape` | Escape raw HTML instead of clobbering it. | `false` |
198
+ | `sourcepos` | Include source position attribute in HTML and XML output. | `false` |
199
+ | `escaped_char_spans` | Wrap escaped characters in span tags. | `true` |
200
+ | `ignore_empty_links` | Ignores empty links, leaving the Markdown text in place. | `false` |
201
+ | `gfm_quirks` | Outputs HTML with GFM-style quirks; namely, not nesting `<strong>` inlines. | `false` |
202
+ | `prefer_fenced` | Always output fenced code blocks, even where an indented one could be used. | `false` |
203
+ | `tasklist_classes` | Add CSS classes to the HTML output of the tasklist extension | `false` |
204
+ | `compact_html` | Suppress newlines in pretty-printed HTML output. | `false` |
187
205
  | `alert_style` | The style of alert output: `"specific"` (`<div class="markdown-alert">`) or `"semantic"` (`<aside class="admonition">`). | `"specific"` |
188
206
 
189
207
  As well, there are several extensions which you can toggle in the same manner:
Binary file
Binary file
Binary file
Binary file
@@ -68,8 +68,8 @@ module Commonmarker
68
68
  syntax_highlighter: {
69
69
  theme: "base16-ocean.dark",
70
70
  path: "",
71
- },
72
- }
71
+ }.freeze,
72
+ }.freeze
73
73
 
74
74
  class << self
75
75
  include Commonmarker::Utils
@@ -28,10 +28,8 @@ module Commonmarker
28
28
  :fence_info,
29
29
  :alert_type,
30
30
  ].filter_map do |name|
31
- [name, __send__(name)]
32
- rescue StandardError
33
- nil
34
- end.compact
31
+ [name, __send__(name)] if respond_to?(name)
32
+ end
35
33
 
36
34
  printer.seplist(attrs) do |name, value|
37
35
  printer.text("#{name}=")
@@ -8,6 +8,18 @@ module Commonmarker
8
8
  include Enumerable
9
9
  include Inspect
10
10
 
11
+ # Public: Whether this node responds to the given method.
12
+ #
13
+ # name - A {Symbol} or {String} naming the method.
14
+ # include_all - A {Boolean} indicating whether to consider private methods.
15
+ #
16
+ # Returns a {Boolean}.
17
+ def respond_to?(name, include_all = false)
18
+ return false if node_supports?(name.to_sym) == false
19
+
20
+ super
21
+ end
22
+
11
23
  # Public: An iterator that "walks the tree," descending into children recursively.
12
24
  #
13
25
  # blk - A {Proc} representing the action to take for each child
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commonmarker
4
- VERSION = "2.9.0"
4
+ VERSION = "2.10.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.10.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Garen Torikian
@@ -9,36 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2026-07-14 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '13.0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '13.0'
28
- - !ruby/object:Gem::Dependency
29
- name: rake-compiler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '1.2'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '1.2'
12
+ date: 2026-08-24 00:00:00.000000000 Z
13
+ dependencies: []
42
14
  description: A fast, safe, extensible parser for CommonMark. This wraps the comrak
43
15
  Rust crate.
44
16
  email: