You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+31-48Lines changed: 31 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,68 +13,41 @@ Categories to use in this document, and the order in which to give them:
13
13
* Behind the scenes
14
14
15
15
16
-
# [v0.45.0-rc.2] - unreleased
16
+
# [v0.45.0] - 2025-10-23
17
17
18
-
Parser changes:
19
-
20
-
* Runs of more than two `~` are no longer recognised as valid delimiters, meaning they will not prevent strikethrough recognition when they occur within correct delimiters. See the PR for discussion. (by @miketheman in https://github.com/kivikakk/comrak/pull/635)
21
-
* This does not impact spec compatibility, matches `cmark-gfm`, and follows the intent of the original implementation and implementor (hi!).
22
-
23
-
Changed APIs:
18
+
Welcome to v0.45.0! This is a big update, much of them part of from [rc.1 from last week](https://github.com/kivikakk/comrak/releases/tag/v0.45.0-rc.1). More context on the size of the update in the changelog there.
24
19
25
-
*`r#unsafe` is used instead of `unsafe_`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/640)
26
-
*`--gemojis` is renamed to `--gemoji`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
27
-
28
-
New APIs:
29
-
30
-
*`node.data()` and `node.data_mut()` are added as short-hand for `node.data.borrow()` and `node.data.borrow_mut()` respectively. (by @kivikakk in https://github.com/kivikakk/comrak/pull/643)
20
+
The biggest library user-facing changes are ergonomic: `Node<'a>` instead of `&'a AstNode<'a>`, is nice, and so likewise `node.data()` instead of `node.data.borrow()`. They're small, but I appreciate them a lot in my own work.
31
21
32
-
Performance:
33
-
34
-
* Inline content is transferred to Text nodes without copying where possible. (by @kivikakk in https://github.com/kivikakk/comrak/pull/642).
35
-
36
-
Documentation:
37
-
38
-
* The CLI help text has been copy-edited to a consistent style. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
39
-
40
-
Build changes:
41
-
42
-
*`shortcodes` is enabled by default (but still optional) for CLI builds. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
22
+
You'll also notice more bovine creatures in the Comrak pasture: there's a few `Cow<str>` instead of `String`, such as in `NodeValue::Text`. At most an extra `.into()` will be required; take note if you use any `'static str`, as they'll no longer need to be heap-allocated. Some `Box`es have been added, too, to reduce the size of every `NodeValue`. Let the types guide you.
43
23
44
-
Diff: TBC
45
-
46
-
47
-
# [v0.45.0-rc.1] - 2025-10-20
48
-
49
-
This is a release candidate for v0.45.0. I've never made a release candidate for Comrak before, but then I've probably never made a release of this size before either.
50
-
51
-
Why the big changes? Quite simply, for the first time in over five years I'm once again working on CommonMark in my [day job](https://about.gitlab.com/company/team/#kivikakk), and for the first time ever _using_ Comrak in it too, and so I find myself thinking about it more, cutting myself on the sharp edges, wishing it were easier to maintain, and wishing it were more efficient. For a little while now, too, I've been [speculating about calling version 1.0](https://github.com/kivikakk/comrak/pull/601).
52
-
53
-
So let's get there. This weekend I found myself profiling and reworking Obviously 2018 Code, and low-hanging fruit, oh my, they are aplenty.
54
-
55
-
It's awkward to do an apples-to-apples comparison of speed between 0.44.0 and 0.45.0-rc.1, because 0.44.0's Comrak benchmark neglected to turn off syntax highlighting, while the benchmark input has something like 14,000 code blocks in it. We were kiiiinda benchmarking syntect. The benchmark also started
56
-
the target process 33 times per run, which adds a lot of undesireable pair.
57
-
58
-
Anyway, I compared the pair using the new benchmark strategy of running the process just once per run, syntax highlighting disabled. Here's what we get on aarch64; on x86_64 the improvement is slightly greater thanks to SIMD:
24
+
Other than this, the options have been put in their own module (`comrak::options`), and a lot of things generally cleaned up. Read below for all the deets! Here's the final performance comparison to v0.44.0 on aarch64:
59
25
60
26
```
61
27
Benchmark 1: ./bench.sh ./comrak-0.44.0
62
-
Time (mean ± σ): 90.0 ms ± 1.0 ms [User: 71.9 ms, System: 18.9 ms]
63
-
Range (min … max): 88.3 ms … 92.9 ms 31 runs
28
+
Time (mean ± σ): 88.1 ms ± 1.9 ms [User: 71.2 ms, System: 17.8 ms]
29
+
Range (min … max): 86.2 ms … 93.2 ms 31 runs
64
30
65
-
Benchmark 2: ./bench.sh ./comrak-0.45.0-rc.1
66
-
Time (mean ± σ): 70.4 ms ± 0.9 ms [User: 53.5 ms, System: 17.9 ms]
67
-
Range (min … max): 69.1 ms … 73.7 ms 40 runs
31
+
Benchmark 2: ./bench.sh ./comrak-0.45.0
32
+
Time (mean ± σ): 67.0 ms ± 1.2 ms [User: 51.2 ms, System: 17.0 ms]
33
+
Range (min … max): 65.2 ms … 70.0 ms 42 runs
68
34
69
35
Summary
70
-
./bench.sh ./comrak-0.45.0-rc.1 ran
71
-
1.28 ± 0.02 times faster than ./bench.sh ./comrak-0.44.0
36
+
./bench.sh ./comrak-0.45.0 ran
37
+
1.32 ± 0.04 times faster than ./bench.sh ./comrak-0.44.0
72
38
```
73
39
74
-
LGTM!
40
+
Be well!
41
+
42
+
Parser changes:
43
+
44
+
* Runs of more than two `~` are no longer recognised as valid delimiters, meaning they will not prevent strikethrough recognition when they occur within correct delimiters. See the PR for discussion. (by @miketheman in https://github.com/kivikakk/comrak/pull/635)
45
+
* This does not impact spec compatibility, matches `cmark-gfm`, and follows the intent of the original implementation and implementor (hi!).
75
46
76
47
Changed APIs:
77
48
49
+
*`r#unsafe` is used instead of `unsafe_`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/640)
50
+
*`--gemojis` is renamed to `--gemoji`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
78
51
*`NodeValue::Text` now contains a `Cow<'static, str>` instead of a `String`. This is a pretty major change, but means we can now create text nodes with static content without duplicating the string on the heap. This particularly benefits smart quotes and HTML entity resolution. (by @kivikakk in https://github.com/kivikakk/comrak/pull/627)
79
52
* Adapting to this change usually means nothing on the read-only side (you can use it as a `&str` without issues); to write in-place, use `.to_mut()` on the `Cow` to get a `&mut String`. To assign, use `.into()` on a `&str` or `String`, like `NodeValue::Text("moo".into())`.
80
53
*`NodeValue::text()` now returns a `&str`. It used to return a `&String` (!).
@@ -93,13 +66,16 @@ Changed APIs:
93
66
*`options.render.ignore_setext` was moved to `options.parse.ignore_setext`, as its effect takes place only in the parse stage. (by @kivikakk in https://github.com/kivikakk/comrak/pull/623)
94
67
*`nodes::can_contain_type` is now `Node::can_contain_type`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/625)
95
68
69
+
96
70
New APIs:
97
71
72
+
*`node.data()` and `node.data_mut()` are added as short-hand for `node.data.borrow()` and `node.data.borrow_mut()` respectively. (by @kivikakk in https://github.com/kivikakk/comrak/pull/643)
98
73
*`comrak::nodes::Node<'a>` is introduced as an alias for `&'a comrak::nodes::AstNode<'a>`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/627)
99
74
*`options.parse.tasklist_in_table` added: parse a tasklist item if it's the only content of a table cell. (by @kivikakk in https://github.com/kivikakk/comrak/pull/622)
100
75
101
76
Performance:
102
77
78
+
* Inline content is transferred to Text nodes without copying where possible. (by @kivikakk in https://github.com/kivikakk/comrak/pull/642).
103
79
* Have you looked at your 7 year old code lately? A detail in the C-to-Rust translation meant essentially every line of input was being copied completely unnecessarily at the very beginning of the line processing stage. This no longer happens. We regret the error. (by @kivikakk in https://github.com/kivikakk/comrak/pull/629)
104
80
* Preprocess entity data at build-time so we don't spend time doing a linear search over an unsorted array, some of which we will never match. (by @kivikakk in https://github.com/kivikakk/comrak/pull/631)
105
81
* Inline content is consumed by the inline processor, instead of being borrowed by it and retained in memory indefinitely. (by @kivikakk in https://github.com/kivikakk/comrak/pull/631)
@@ -116,18 +92,25 @@ Dependency updates:
116
92
117
93
Documentation:
118
94
95
+
* The CLI help text has been copy-edited to a consistent style. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
119
96
* The `README` example code is updated to build with recent API changes. (by @kivikakk in https://github.com/kivikakk/comrak/pull/621)
120
97
121
98
Build changes:
122
99
100
+
*`shortcodes` is enabled by default (but still optional) for CLI builds. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
123
101
*`syntect` is now optional (but still default) in CLI builds. (by @kivikakk in https://github.com/kivikakk/comrak/pull/624)
124
102
125
103
Behind the scenes:
126
104
127
105
* Much of the block parser code has been re-organised, and many C-isms from the original port have been refactored into readable Rust. (by @kivikakk in https://github.com/kivikakk/comrak/pull/627)
106
+
* Likewise the inline parser has been re-organised. (by @kivikakk in https://github.com/kivikakk/comrak/pull/644)
128
107
* All `unsafe` blocks now have a `SAFETY` comment describing why their actions are safe.
0 commit comments