Update Rust crate comrak to v0.45.0 #12178
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
=0.44.0->=0.45.0Release Notes
kivikakk/comrak (comrak)
v0.45.0Compare Source
Welcome to v0.45.0! This is a big update, much of them part of from rc.1 from last week. More context on the size of the update in the changelog there.
The biggest library user-facing changes are ergonomic:
Node<'a>instead of&'a AstNode<'a>, is nice, and so likewisenode.data()instead ofnode.data.borrow(). They're small, but I appreciate them a lot in my own work.You'll also notice more bovine creatures in the Comrak pasture: there's a few
Cow<str>instead ofString, such as inNodeValue::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. SomeBoxes have been added, too, to reduce the size of everyNodeValue. Let the types guide you.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:Be well!
Parser changes:
~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 #635)cmark-gfm, and follows the intent of the original implementation and implementor (hi!).Changed APIs:
r#unsafeis used instead ofunsafe_. (by @kivikakk in #640)--gemojisis renamed to--gemoji. (by @kivikakk in #641)NodeValue::Textnow contains aCow<'static, str>instead of aString. 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 #627)&strwithout issues); to write in-place, use.to_mut()on theCowto get a&mut String. To assign, use.into()on a&strorString, likeNodeValue::Text("moo".into()).NodeValue::text()now returns a&str. It used to return a&String(!).NodeValue::text_mut()now returns a&mut Cow<'static, str>, instead of a&mut String. This permits writing a borrowed reference.Cow; it'd be amazing to refer continuously to the input where possible.NodeValue'sCodeBlock,Table,Link,Image,ShortCodeandAlertvariants' payloads are now boxed. (by @kivikakk in #632)Box::newcall when constructing these nodes, and on matches, pulling the box out and then just dereferencing it directly (e.g.NodeValue::Table(nt) => &nt.alignmentsinstead ofNodeValue::Table(NodeTable { ref alignments }).Astto 128 bytes, and a fullAstNode<'_>to 176 bytes.NodeValueresults in worse performance than doing nothing at all. This change appreciably improves matters.Ast.comrak::options. Structs have been renamed to removeOptionsfrom their name:comrak::RenderOptionsis nowcomrak::options::Render, etc. The old names are marked deprecated. (@kivikakk in #636)URLRewriterandBrokenLinkCallbackhave been moved, without a deprecation period.SyntaxHighlighterAdapter'sattributesarguments now takeHashMap<&'static str, Cow<'s, str>>; they used to takeHashMap<String, String>. (by @kivikakk in #633)html::write_opening_tagcan now take differentAsRef<str>types for the attribute key and value.parse_document_with_broken_link_callbackhas been removed! This entrypoint has been deprecated since 0.25.0. (by @kivikakk in #623)options.render.ignore_setextwas moved tooptions.parse.ignore_setext, as its effect takes place only in the parse stage. (by @kivikakk in #623)nodes::can_contain_typeis nowNode::can_contain_type. (by @kivikakk in #625)New APIs:
node.data()andnode.data_mut()are added as short-hand fornode.data.borrow()andnode.data.borrow_mut()respectively. (by @kivikakk in #643)comrak::nodes::Node<'a>is introduced as an alias for&'a comrak::nodes::AstNode<'a>. (by @kivikakk in #627)options.parse.tasklist_in_tableadded: parse a tasklist item if it's the only content of a table cell. (by @kivikakk in #622)Performance:
strinternally in block and inline processing, eliminating many UTF-8 rechecks. Thestringsmodule actually operates on strings now. (by @kivikakk in #626)Dependency updates:
memchrremoved fromCargo.toml; it wasn't used directly, though it still is included unconditionally due tocaseless. (by @kivikakk in #630)slugis moved to a development-only dependency; it's only used in an example. (by @kivikakk in #630)jetsciiis added for faster string searching, including SIMD on x86_64. (by @kivikakk in #630)Documentation:
READMEexample code is updated to build with recent API changes. (by @kivikakk in #621)Build changes:
shortcodesis enabled by default (but still optional) for CLI builds. (by @kivikakk in #641)syntectis now optional (but still default) in CLI builds. (by @kivikakk in #624)Behind the scenes:
unsafeblocks now have aSAFETYcomment describing why their actions are safe.New Contributors
Diff: kivikakk/comrak@v0.44.0...v0.45.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.