Skip to content

Commit fdb17fc

Browse files
authored
Merge pull request #645 from kivikakk/release/v0.45.0
Release v0.45.0.
2 parents 623ca6c + ed71669 commit fdb17fc

File tree

2 files changed

+59
-74
lines changed

2 files changed

+59
-74
lines changed

CHANGELOG.md

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,68 +13,41 @@ Categories to use in this document, and the order in which to give them:
1313
* Behind the scenes
1414

1515

16-
# [v0.45.0-rc.2] - unreleased
16+
# [v0.45.0] - 2025-10-23
1717

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.
2419

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.
3121

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.
4323

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:
5925

6026
```
6127
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
6430
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
6834
6935
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
7238
```
7339

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!).
7546

7647
Changed APIs:
7748

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)
7851
* `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)
7952
* 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())`.
8053
* `NodeValue::text()` now returns a `&str`. It used to return a `&String` (!).
@@ -93,13 +66,16 @@ Changed APIs:
9366
* `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)
9467
* `nodes::can_contain_type` is now `Node::can_contain_type`. (by @kivikakk in https://github.com/kivikakk/comrak/pull/625)
9568

69+
9670
New APIs:
9771

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)
9873
* `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)
9974
* `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)
10075

10176
Performance:
10277

78+
* Inline content is transferred to Text nodes without copying where possible. (by @kivikakk in https://github.com/kivikakk/comrak/pull/642).
10379
* 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)
10480
* 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)
10581
* 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:
11692

11793
Documentation:
11894

95+
* The CLI help text has been copy-edited to a consistent style. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
11996
* The `README` example code is updated to build with recent API changes. (by @kivikakk in https://github.com/kivikakk/comrak/pull/621)
12097

12198
Build changes:
12299

100+
* `shortcodes` is enabled by default (but still optional) for CLI builds. (by @kivikakk in https://github.com/kivikakk/comrak/pull/641)
123101
* `syntect` is now optional (but still default) in CLI builds. (by @kivikakk in https://github.com/kivikakk/comrak/pull/624)
124102

125103
Behind the scenes:
126104

127105
* 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)
128107
* All `unsafe` blocks now have a `SAFETY` comment describing why their actions are safe.
129108

130-
Diff: https://github.com/kivikakk/comrak/compare/v0.44.0...v0.45.0-rc.1
109+
## New Contributors
110+
111+
* @miketheman made their first contribution in https://github.com/kivikakk/comrak/pull/635
112+
113+
Diff: https://github.com/kivikakk/comrak/compare/v0.44.0...v0.45.0
131114

132115

133116
# [v0.44.0] - 2025-10-14

README.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Specify it as a requirement in `Cargo.toml`:
1616

1717
``` toml
1818
[dependencies]
19-
comrak = "0.45.0-rc"
19+
comrak = "0.45"
2020
```
2121

2222
Comrak's library supports Rust <span class="msrv">1.65</span>+.
@@ -62,57 +62,58 @@ Options:
6262
[default: /home/runner/.config/comrak/config]
6363
6464
-i, --inplace
65-
To perform an in-place formatting
65+
Reformat a CommonMark file in-place
6666
6767
--hardbreaks
6868
Treat newlines as hard line breaks
6969
7070
--smart
71-
Use smart punctuation
71+
Replace punctuation like "this" with smart punctuation like “this”
7272
7373
--github-pre-lang
74-
Use GitHub-style <pre lang> for code blocks
74+
Use GitHub-style "<pre lang>" for code blocks
7575
7676
--full-info-string
77-
Enable full info strings for code blocks
77+
Include words following the code block info string in a data-meta attribute
7878
7979
--gfm
8080
Enable GitHub-flavored markdown extensions: strikethrough, tagfilter, table, autolink, and
8181
tasklist. Also enables --github-pre-lang and --gfm-quirks
8282
8383
--gfm-quirks
84-
Enables GFM-style quirks in output HTML, such as not nesting <strong> tags, which
85-
otherwise breaks CommonMark compatibility
84+
Use GFM-style quirks in output HTML, such as not nesting <strong> tags, which otherwise
85+
breaks CommonMark compatibility
8686
8787
--relaxed-tasklist-character
88-
Enable relaxing which character is allowed in a tasklists
88+
Permit any character inside a tasklist item, not just " ", "x" or "X"
8989
9090
--relaxed-autolinks
91-
Enable relaxing of autolink parsing, allow links to be recognized when in brackets and
92-
allow all url schemes
91+
Relax autolink parsing: allows links to be recognised when in brackets, permits all URL
92+
schemes, and permits domains without a TLD (like "http://localhost")
9393
9494
--tasklist-classes
95-
Output classes on tasklist elements so that they can be styled with CSS
95+
Include "task-list-item" and "task-list-item-checkbox" classes on
9696
9797
--default-info-string <INFO>
9898
Default value for fenced code block's info strings if none is given
9999
100100
--unsafe
101-
Allow raw HTML and dangerous URLs
101+
Allow inline and block HTML (unless --escape is given), and permit
102102
103-
--gemojis
104-
Translate gemojis into UTF-8 characters
103+
--gemoji
104+
Translate gemoji like ":thumbsup:" into Unicode emoji like "👍"
105105
106106
--escape
107-
Escape raw HTML instead of clobbering it
107+
Escape raw HTML, instead of clobbering it; takes precedence over --unsafe
108108
109109
--escaped-char-spans
110-
Wrap escaped characters in span tags
110+
Wrap escaped Markdown characters in "<span data-escaped-char>" in HTML
111111
112112
-e, --extension <EXTENSION>
113-
Specify extension name(s) to use
113+
Specify extensions to use
114114
115-
Multiple extensions can be delimited with ",", e.g. --extension strikethrough,table
115+
Multiple extensions can be delimited with ",", e.g. '--extension strikethrough,table', or
116+
you can pass --extension/-e multiple times
116117
117118
[possible values: strikethrough, tagfilter, table, autolink, tasklist, superscript,
118119
footnotes, inline-footnotes, description-lists, multiline-block-quotes, math-dollars,
@@ -129,38 +130,39 @@ Options:
129130
Write output to FILE instead of stdout
130131
131132
--width <WIDTH>
132-
Specify wrap width (0 = nowrap)
133+
Specify wrap width for output CommonMark, or '0' to disable wrapping
133134
134135
[default: 0]
135136
136137
--header-ids <PREFIX>
137138
Use the Comrak header IDs extension, with the given ID prefix
138139
139140
--front-matter-delimiter <DELIMITER>
140-
Ignore front-matter that starts and ends with the given string
141+
Detect frontmatter that starts and ends with the given string, and do not include it in
142+
the resulting document
141143
142144
--syntax-highlighting <THEME>
143-
Syntax highlighting for codefence blocks. Choose a theme or 'none' for disabling
145+
Syntax highlighting theme for fenced code blocks; specify a theme, or 'none' to disable
144146
145147
[default: base16-ocean.dark]
146148
147149
--list-style <LIST_STYLE>
148-
Specify bullet character for lists (-, +, *) in CommonMark output
150+
Specify bullet character for lists ("-", "+", "*") in CommonMark output
149151
150152
[default: dash]
151153
[possible values: dash, plus, star]
152154
153155
--sourcepos
154-
Include source position attribute in HTML and XML output
156+
Include source position attributes in HTML and XML output
155157
156158
--ignore-setext
157-
Ignore setext headers
159+
Do not parse setext headers
158160
159161
--ignore-empty-links
160-
Ignore empty links
162+
Do not parse empty links
161163
162164
--experimental-minimize-commonmark
163-
Minimize escapes in CommonMark output using a trial-and-error algorithm
165+
Minimise escapes in CommonMark output using a trial-and-error algorithm
164166
165167
-h, --help
166168
Print help information (use `-h` for a summary)

0 commit comments

Comments
 (0)