diff --git a/patches/comrak-labs/Cargo.toml.diff b/patches/comrak-labs/Cargo.toml.diff deleted file mode 100644 index 3cdb907..0000000 --- a/patches/comrak-labs/Cargo.toml.diff +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/Cargo.toml b/Cargo.toml -index d246fb3..b922bd5 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -44,6 +44,8 @@ bon = { version = "3", optional = true } - caseless = "0.2.1" - fmt2io = { version = "1.0.0", optional = true } - jetscii = "0.5.3" -+serde = { version = "1.0", optional = true, features = ["derive", "alloc", "rc"] } -+serde_json = { version = "1.0", optional = true, features = ["alloc", "preserve_order", "raw_value"] } - - [dev-dependencies] - ntest = "0.9" -@@ -57,11 +59,14 @@ pretty_assertions = "1.4.1" - entities = "1.0.1" - - [features] --default = ["cli", "syntect", "bon"] -+default = ["cli", "syntect", "bon", "serialization"] - cli = ["clap", "bon", "shell-words", "xdg", "fmt2io", "shortcodes", "phoenix_heex"] - shortcodes = ["emojis"] - phoenix_heex = [] - bon = ["dep:bon"] -+serde = ["dep:serde"] -+serde_json = ["dep:serde_json"] -+serialization = ["serde", "serde_json"] - - [target.'cfg(all(not(windows), not(target_arch="wasm32")))'.dependencies] - xdg = { version = "^2.5", optional = true } diff --git a/patches/comrak-labs/src/adapters.rs.diff b/patches/comrak-labs/src/adapters.rs.diff deleted file mode 100644 index 8b51662..0000000 --- a/patches/comrak-labs/src/adapters.rs.diff +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/src/adapters.rs b/src/adapters.rs -index 236f689..3517370 100644 ---- a/src/adapters.rs -+++ b/src/adapters.rs -@@ -44,6 +44,10 @@ pub trait SyntaxHighlighterAdapter: Send + Sync { - - /// The struct passed to the [`HeadingAdapter`] for custom heading implementations. - #[derive(Clone, Debug)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct HeadingMeta { - /// The level of the heading; from 1 to 6 for ATX headings, 1 or 2 for setext headings. - pub level: u8, diff --git a/patches/comrak-labs/src/arena_tree.rs.diff b/patches/comrak-labs/src/arena_tree.rs.diff deleted file mode 100644 index 8c9c2aa..0000000 --- a/patches/comrak-labs/src/arena_tree.rs.diff +++ /dev/null @@ -1,343 +0,0 @@ -diff --git a/src/arena_tree.rs b/src/arena_tree.rs -index c39186f..8ccc32c 100644 ---- a/src/arena_tree.rs -+++ b/src/arena_tree.rs -@@ -27,6 +27,284 @@ pub struct Node<'a, T: 'a> { - pub data: T, - } - -+#[cfg(feature = "serde")] -+mod serde_impls { -+ use super::Node; -+ use std::collections::HashMap; -+ -+ use serde::{de::Error as DeError, Deserialize, Serialize, Serializer}; -+ use typed_arena::Arena; -+ -+ /// Serializable representation of a Node for serde. -+ /// -+ /// Avoids cycles during serialization/deserialization by using integer -+ /// indices instead of actual references. These are resolved during -+ /// deserialization into actual references after all nodes are created. -+ /// -+ /// All indices are relative to the [`WireTree::nodes`] array, which holds -+ /// all nodes in the tree and acts as a temporary arena for this purpose. -+ #[derive(Default, Serialize, Deserialize)] -+ struct WireNode { -+ parent: Option, -+ #[serde(default, skip_serializing_if = "Option::is_none")] -+ previous_sibling: Option, -+ #[serde(default, skip_serializing_if = "Option::is_none")] -+ next_sibling: Option, -+ #[serde(default, skip_serializing_if = "Option::is_none")] -+ first_child: Option, -+ #[serde(default, skip_serializing_if = "Option::is_none")] -+ last_child: Option, -+ data: T, -+ } -+ -+ /// Serializable representation of an arena tree for serde. -+ /// -+ /// Holds all nodes in a flat vector to avoid cycles during -+ /// serialization and deserialization. References between nodes are represented -+ /// as integer indices in the array. These are resolved during the final -+ /// resolution step of deserialization, after all nodes are created, into -+ /// actual references and [`Node`] structs. This allows serde to serialize -+ /// and deserialize the [`Node`] tree structure without running into issues -+ /// with reference cycles. -+ #[derive(Default, Serialize, Deserialize)] -+ struct WireTree { -+ nodes: Vec>, -+ } -+ -+ impl<'a, T: 'a> Serialize for Node<'a, T> -+ where -+ T: Serialize, -+ { -+ fn serialize(&self, serializer: S) -> Result -+ where -+ S: Serializer, -+ { -+ // Force the borrow of `self` to match the lifetime carried by the -+ // node so it can be threaded through the traversal. -+ let root: &'a Node<'a, T> = -+ unsafe { std::mem::transmute::<&Node<'a, T>, &'a Node<'a, T>>(self) }; -+ let mut ordered = Vec::new(); -+ for node in root.descendants() { -+ ordered.push(node); -+ } -+ -+ let mut ids = HashMap::with_capacity(ordered.len()); -+ for (idx, node) in ordered.iter().enumerate() { -+ ids.insert(std::ptr::from_ref(*node) as usize, idx as u32); -+ } -+ -+ let index_for = |node: Option<&'a Node<'a, T>>| { -+ node.map(|n| ids[&(std::ptr::from_ref(n) as usize)]) -+ }; -+ -+ WireTree { -+ nodes: ordered -+ .iter() -+ .map(|node| WireNode { -+ parent: index_for(node.parent()), -+ previous_sibling: index_for(node.previous_sibling()), -+ next_sibling: index_for(node.next_sibling()), -+ first_child: index_for(node.first_child()), -+ last_child: index_for(node.last_child()), -+ data: &node.data, -+ }) -+ .collect::>(), -+ } -+ .serialize(serializer) -+ } -+ } -+ -+ impl<'a, 'de, T: 'a + 'de> serde::Deserialize<'de> for &'a Node<'a, T> -+ where -+ T: serde::Deserialize<'de>, -+ { -+ fn deserialize(deserializer: D) -> Result -+ where -+ D: serde::Deserializer<'de>, -+ { -+ let WireTree { nodes: wire_nodes } = WireTree::::deserialize(deserializer)?; -+ if wire_nodes.is_empty() { -+ return Err(DeError::custom("cannot deserialize empty tree")); -+ } -+ -+ let arena = Box::leak(Box::new(Arena::>::new())); -+ let mut nodes: Vec<&Node<'de, T>> = Vec::with_capacity(wire_nodes.len()); -+ let mut peers = Vec::with_capacity(wire_nodes.len()); -+ -+ for wire in wire_nodes.into_iter() { -+ peers.push(( -+ wire.parent, -+ wire.previous_sibling, -+ wire.next_sibling, -+ wire.first_child, -+ wire.last_child, -+ )); -+ nodes.push(arena.alloc(Node::new(wire.data))); -+ } -+ -+ for (node, peer) in nodes.iter().zip(peers.into_iter()) { -+ let (parent, prev, next, first, last) = peer; -+ let parent_ref = -+ match parent { -+ Some(i) => Some(*nodes.get(i as usize).ok_or_else(|| { -+ DeError::custom(format!("node index {i} out of bounds")) -+ })?), -+ None => None, -+ }; -+ let prev_ref = -+ match prev { -+ Some(i) => Some(*nodes.get(i as usize).ok_or_else(|| { -+ DeError::custom(format!("node index {i} out of bounds")) -+ })?), -+ None => None, -+ }; -+ let next_ref = -+ match next { -+ Some(i) => Some(*nodes.get(i as usize).ok_or_else(|| { -+ DeError::custom(format!("node index {i} out of bounds")) -+ })?), -+ None => None, -+ }; -+ let first_ref = -+ match first { -+ Some(i) => Some(*nodes.get(i as usize).ok_or_else(|| { -+ DeError::custom(format!("node index {i} out of bounds")) -+ })?), -+ None => None, -+ }; -+ let last_ref = -+ match last { -+ Some(i) => Some(*nodes.get(i as usize).ok_or_else(|| { -+ DeError::custom(format!("node index {i} out of bounds")) -+ })?), -+ None => None, -+ }; -+ -+ node.parent.set(parent_ref); -+ node.previous_sibling.set(prev_ref); -+ node.next_sibling.set(next_ref); -+ node.first_child.set(first_ref); -+ node.last_child.set(last_ref); -+ } -+ -+ let root = nodes[0]; -+ // SAFETY: The arena is leaked, so the references live for the -+ // remainder of the program. Since `T: 'a + 'de`, the data inside -+ // the nodes also live for 'a. Thus, the whole tree rooted at -+ // `root` lives for 'a; shortening the lifetime should be safe. -+ Ok(unsafe { core::mem::transmute::<&Node<'de, T>, &Node<'a, T>>(root) }) -+ } -+ } -+ -+ #[cfg(test)] -+ mod tests { -+ use crate::nodes::Ast; -+ -+ use super::super::*; -+ use serde_json; -+ #[test] -+ fn basic_serialization_roundtrip() { -+ let arena = typed_arena::Arena::new(); -+ let root = arena.alloc(Node::new("root")); -+ let child1 = arena.alloc(Node::new("child1")); -+ let child2 = arena.alloc(Node::new("child2")); -+ root.append(child1); -+ root.append(child2); -+ -+ let serialized = serde_json::to_string(&root).unwrap(); -+ let deserialized: &Node<'_, &str> = serde_json::from_str(&serialized).unwrap(); -+ -+ assert_eq!(deserialized.data, "root"); -+ -+ let mut children = deserialized.children(); -+ assert_eq!(children.next().unwrap().data, "child1"); -+ assert_eq!(children.next().unwrap().data, "child2"); -+ assert!(children.next().is_none()); -+ } -+ -+ #[test] -+ fn empty_tree_serialization_fails() { -+ let result: Result<&Node<'_, &str>, _> = serde_json::from_str(r#"{"nodes":[]}"#); -+ assert!(result.is_err()); -+ } -+ -+ #[test] -+ fn out_of_bounds_index_fails() { -+ let result: Result<&Node<'_, &str>, _> = serde_json::from_str( -+ r#"{ -+ "nodes": [ -+ { -+ "first_child": 1, -+ "last_child": 1, -+ "data": "root" -+ } -+ ] -+}"#, -+ ); -+ assert!(result.is_err()); -+ } -+ -+ #[test] -+ /// A more complex tree to ensure references are correctly resolved -+ /// when deserializing a tree with multiple levels and siblings, much -+ /// like our actual parsed AST structures. -+ fn complex_tree_serialization_roundtrip() { -+ use crate::nodes::NodeValue; -+ use crate::options::*; -+ use crate::parse_document; -+ use crate::Arena; -+ let arena = Arena::new(); -+ let root = parse_document( -+ &arena, -+ r#"# Hello World -+ -+## This is a subtitle -+ -+And this a paragraph. -+"#, -+ &Options::default(), -+ ); -+ -+ let serialized = serde_json::to_string_pretty(&root).unwrap(); -+ let deserialized: &Node<'_, RefCell> = serde_json::from_str(&serialized).unwrap(); -+ -+ // Check root node -+ assert!(matches!(deserialized.data().value, NodeValue::Document)); -+ -+ // Check first child (heading 1) -+ let mut children = deserialized.children(); -+ -+ let heading1 = children.next().unwrap(); -+ assert!(matches!(heading1.data().value, NodeValue::Heading(_))); -+ -+ let heading1_text = heading1.first_child().unwrap(); -+ assert!( -+ matches!(heading1_text.data().value, NodeValue::Text(ref text) if *text == "Hello World") -+ ); -+ -+ // Check second child (heading 2) -+ let heading2 = children.next().unwrap(); -+ assert!(matches!(heading2.data().value, NodeValue::Heading(_))); -+ -+ let heading2_text = heading2.first_child().unwrap(); -+ assert!( -+ matches!(heading2_text.data().value, NodeValue::Text(ref text) if *text == "This is a subtitle") -+ ); -+ -+ // Check third child (paragraph) -+ let paragraph = children.next().unwrap(); -+ assert!(matches!(paragraph.data().value, NodeValue::Paragraph)); -+ -+ let paragraph_text = paragraph.first_child().unwrap(); -+ assert!( -+ matches!(paragraph_text.data().value, NodeValue::Text(ref text) if *text == "And this a paragraph.") -+ ); -+ -+ assert!(children.next().is_none()); -+ } -+ } -+} -+ - /// A simple Debug implementation that prints the children as a tree, without - /// looping through the various interior pointer cycles. - impl<'a, T: 'a> fmt::Debug for Node<'a, RefCell> -@@ -62,7 +340,7 @@ impl<'a, T> Node<'a, T> { - /// - /// Typically, this node needs to be moved into an arena allocator - /// before it can be used in a tree. -- pub fn new(data: T) -> Node<'a, T> { -+ pub const fn new(data: T) -> Node<'a, T> { - Node { - parent: Cell::new(None), - first_child: Cell::new(None), -@@ -427,6 +705,23 @@ traverse_iterator! { - ReverseTraverse: last_child, previous_sibling - } - -+impl<'a, T> Node<'a, RefCell> { -+ /// Shorthand for `node.data.borrow()`. -+ pub fn data(&self) -> Ref<'_, T> { -+ self.data.borrow() -+ } -+ -+ /// Shorthand for `node.data.try_borrow()`. -+ pub fn try_data(&self) -> Result, BorrowError> { -+ self.data.try_borrow() -+ } -+ -+ /// Shorthand for `node.data.borrow_mut()`. -+ pub fn data_mut(&self) -> RefMut<'_, T> { -+ self.data.borrow_mut() -+ } -+} -+ - #[test] - fn it_works() { - struct DropTracker<'a>(&'a Cell); -@@ -470,20 +765,3 @@ fn it_works() { - - assert_eq!(drop_counter.get(), 10); - } -- --impl<'a, T> Node<'a, RefCell> { -- /// Shorthand for `node.data.borrow()`. -- pub fn data(&self) -> Ref<'_, T> { -- self.data.borrow() -- } -- -- /// Shorthand for `node.data.try_borrow()`. -- pub fn try_data(&self) -> Result, BorrowError> { -- self.data.try_borrow() -- } -- -- /// Shorthand for `node.data.borrow_mut()`. -- pub fn data_mut(&self) -> RefMut<'_, T> { -- self.data.borrow_mut() -- } --} diff --git a/patches/comrak-labs/src/lib.rs.diff b/patches/comrak-labs/src/lib.rs.diff deleted file mode 100644 index be75679..0000000 --- a/patches/comrak-labs/src/lib.rs.diff +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/src/lib.rs b/src/lib.rs -index 5957819..1705a53 100644 ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -114,7 +114,7 @@ pub type ExtensionOptions<'c> = parser::options::Extension<'c>; - pub type ParseOptions<'c> = parser::options::Parse<'c>; - #[deprecated( - since = "0.45.0", -- note = "use `comrak::options::Render` instead of `comrak::RenderOptions `" -+ note = "use `comrak::options::Render` instead of `comrak::RenderOptions`" - )] - /// Deprecated alias: use [`options::Render`] instead of [`RenderOptions ]`. - pub type RenderOptions = parser::options::Render; -@@ -127,7 +127,7 @@ pub type RenderOptions = parser::options::Render; - pub type BrokenLinkReference<'l> = parser::options::BrokenLinkReference<'l>; - #[deprecated( - since = "0.45.0", -- note = "use `comrak::options::ListStyleType` instead of `comrak::ListStyleType `" -+ note = "use `comrak::options::ListStyleType` instead of `comrak::ListStyleType`" - )] - /// Deprecated alias: use [`options::ListStyleType`] instead of [`ListStyleType ]`. - pub type ListStyleType = parser::options::ListStyleType; -@@ -145,7 +145,7 @@ pub type Plugins<'p> = parser::options::Plugins<'p>; - pub type RenderPlugins<'p> = parser::options::RenderPlugins<'p>; - #[deprecated( - since = "0.45.0", -- note = "use `comrak::options::WikiLinksMode` instead of `comrak::WikiLinksMode `" -+ note = "use `comrak::options::WikiLinksMode` instead of `comrak::WikiLinksMode`" - )] - /// Deprecated alias: use [`options::WikiLinksMode`] instead of [`WikiLinksMode ]`. - pub type WikiLinksMode = parser::options::WikiLinksMode; -@@ -167,7 +167,7 @@ pub type ParseOptionsBuilder<'c> = parser::options::ParseBuilder<'c>; - #[cfg(feature = "bon")] - #[deprecated( - since = "0.45.0", -- note = "use `comrak::options::RenderBuilder` instead of `comrak::RenderOptionsBuilder `" -+ note = "use `comrak::options::RenderBuilder` instead of `comrak::RenderOptionsBuilder`" - )] - /// Deprecated alias: use [`options::RenderBuilder`] instead of [`RenderOptionsBuilder ]`. - pub type RenderOptionsBuilder = parser::options::RenderBuilder; -@@ -209,7 +209,7 @@ pub fn markdown_to_html_with_plugins( - } - - /// Return the version of the crate. --pub fn version() -> &'static str { -+pub const fn version() -> &'static str { - env!("CARGO_PKG_VERSION") - } - diff --git a/patches/comrak-labs/src/nodes.rs.diff b/patches/comrak-labs/src/nodes.rs.diff deleted file mode 100644 index aa753d8..0000000 --- a/patches/comrak-labs/src/nodes.rs.diff +++ /dev/null @@ -1,254 +0,0 @@ -diff --git a/src/nodes.rs b/src/nodes.rs -index 1ab2de5..96c2a64 100644 ---- a/src/nodes.rs -+++ b/src/nodes.rs -@@ -31,6 +31,10 @@ macro_rules! node_matches { - test, - strum_discriminants(vis(pub(crate)), derive(strum::VariantArray, Hash)) - )] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub enum NodeValue { - /// The root of every CommonMark document. Contains **blocks**. - Document, -@@ -253,6 +257,10 @@ pub enum NodeValue { - - /// Alignment of a single table cell. - #[derive(Debug, Copy, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub enum TableAlignment { - /// Cell content is unaligned. - None, -@@ -280,6 +288,10 @@ impl TableAlignment { - - /// The metadata of a table - #[derive(Debug, Default, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeTable { - /// The table alignments - pub alignments: Vec, -@@ -296,6 +308,10 @@ pub struct NodeTable { - - /// An inline [code span](https://github.github.com/gfm/#code-spans). - #[derive(Default, Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeCode { - /// The number of backticks - pub num_backticks: usize, -@@ -309,6 +325,10 @@ pub struct NodeCode { - - /// The details of a link's destination, or an image's source. - #[derive(Default, Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeLink { - /// The URL for the link destination or image source. - pub url: String, -@@ -322,6 +342,10 @@ pub struct NodeLink { - - /// The details of a wikilink's destination. - #[derive(Default, Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeWikiLink { - /// The URL for the link destination. - pub url: String, -@@ -329,6 +353,10 @@ pub struct NodeWikiLink { - - /// The metadata of a list; the kind of list, the delimiter used and so on. - #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeList { - /// The kind of list (bullet (unordered) or ordered). - pub list_type: ListType, -@@ -358,6 +386,10 @@ pub struct NodeList { - - /// The metadata of a description list - #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeDescriptionItem { - /// Number of spaces before the list marker. - pub marker_offset: usize, -@@ -372,6 +404,10 @@ pub struct NodeDescriptionItem { - - /// The type of list. - #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub enum ListType { - /// A bullet list, i.e. an unordered list. - #[default] -@@ -383,6 +419,10 @@ pub enum ListType { - - /// The delimiter for ordered lists, i.e. the character which appears after each number. - #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub enum ListDelimType { - /// A period character `.`. - #[default] -@@ -403,6 +443,10 @@ impl ListDelimType { - - /// The metadata and data of a code block (fenced or indented). - #[derive(Default, Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeCodeBlock { - /// Whether the code block is fenced. - pub fenced: bool, -@@ -432,6 +476,10 @@ pub struct NodeCodeBlock { - - /// The metadata of a heading. - #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeHeading { - /// The level of the header; from 1 to 6 for ATX headings, 1 or 2 for setext headings. - pub level: u8, -@@ -446,6 +494,10 @@ pub struct NodeHeading { - - /// The metadata of an included HTML block. - #[derive(Debug, Default, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeHtmlBlock { - /// The HTML block's type - pub block_type: u8, -@@ -457,6 +509,10 @@ pub struct NodeHtmlBlock { - - /// The metadata of a footnote definition. - #[derive(Debug, Default, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeFootnoteDefinition { - /// The name of the footnote. - pub name: String, -@@ -467,6 +523,10 @@ pub struct NodeFootnoteDefinition { - - /// The metadata of a footnote reference. - #[derive(Debug, Default, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeFootnoteReference { - /// The name of the footnote. - pub name: String, -@@ -483,6 +543,10 @@ pub struct NodeFootnoteReference { - - /// The metadata of a multiline blockquote. - #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeMultilineBlockQuote { - /// The length of the fence. - pub fence_length: usize, -@@ -493,6 +557,10 @@ pub struct NodeMultilineBlockQuote { - - /// An inline math span - #[derive(Default, Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeMath { - /// Whether this is dollar math (`$` or `$$`). - /// `false` indicates it is code math -@@ -510,6 +578,10 @@ pub struct NodeMath { - - /// The metadata of an Alert node. - #[derive(Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeAlert { - /// Type of alert - pub alert_type: AlertType, -@@ -529,6 +601,10 @@ pub struct NodeAlert { - - /// The type of alert. - #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub enum AlertType { - /// Useful information that users should know, even when skimming content - #[default] -@@ -708,6 +784,10 @@ impl NodeValue { - /// The struct contains metadata about the node's position in the original document, and the core - /// enum, `NodeValue`. - #[derive(Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct Ast { - /// The node value itself. - pub value: NodeValue, -@@ -745,6 +825,10 @@ const AST_NODE_SIZE_ASSERTION: [u8; 176] = [0; std::mem::size_of::>( - - /// Represents the position in the source Markdown this node was rendered from. - #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct Sourcepos { - /// The line and column of the first character of this node. - pub start: LineColumn, -@@ -791,6 +875,10 @@ impl From<(usize, usize, usize, usize)> for Sourcepos { - - /// Represents the 1-based line and column positions of a given character. - #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct LineColumn { - /// The 1-based line number of the character. - pub line: usize, -@@ -902,6 +990,7 @@ impl<'a> From for AstNode<'a> { - - /// Validation errors produced by [arena_tree::Node::validate]. - #[derive(Debug, Clone)] -+#[cfg_attr(feature = "serde", derive(serde::Serialize))] - pub enum ValidationError<'a> { - /// The type of a child node is not allowed in the parent node. This can happen when an inline - /// node is found in a block container, a block is found in an inline node, etc. diff --git a/patches/comrak-labs/src/parser/mod.rs.diff b/patches/comrak-labs/src/parser/mod.rs.diff deleted file mode 100644 index 26e5c8e..0000000 --- a/patches/comrak-labs/src/parser/mod.rs.diff +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/parser/mod.rs b/src/parser/mod.rs -index 3432071..dfb994c 100644 ---- a/src/parser/mod.rs -+++ b/src/parser/mod.rs -@@ -90,6 +90,7 @@ pub struct Parser<'a, 'o, 'c> { - - /// A reference link's resolved details. - #[derive(Clone, Debug)] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] - pub struct ResolvedReference { - /// The destination URL of the reference link. - pub url: String, -@@ -98,6 +99,7 @@ pub struct ResolvedReference { - pub title: String, - } - -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] - struct FootnoteDefinition<'a> { - ix: Option, - node: Node<'a>, diff --git a/patches/comrak-labs/src/parser/options.rs.diff b/patches/comrak-labs/src/parser/options.rs.diff deleted file mode 100644 index 92b4d69..0000000 --- a/patches/comrak-labs/src/parser/options.rs.diff +++ /dev/null @@ -1,124 +0,0 @@ -diff --git a/src/parser/options.rs b/src/parser/options.rs -index 9a93bc1..d83ea10 100644 ---- a/src/parser/options.rs -+++ b/src/parser/options.rs -@@ -12,6 +12,12 @@ use crate::parser::ResolvedReference; - - #[derive(Default, Debug, Clone)] - #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -+#[cfg_attr(feature = "serde", serde(default))] -+#[cfg_attr( -+ all(target_arch = "wasm32", feature = "serde"), -+ serde(rename_all = "camelCase") -+)] - /// Umbrella options struct. - pub struct Options<'c> { - /// Enable CommonMark extensions. -@@ -27,6 +33,12 @@ pub struct Options<'c> { - #[derive(Default, Debug, Clone)] - #[cfg_attr(feature = "bon", derive(Builder))] - #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -+#[cfg_attr(feature = "serde", serde(default))] -+#[cfg_attr( -+ all(target_arch = "wasm32", feature = "serde"), -+ serde(rename_all = "camelCase") -+)] - /// Options to select extensions. - pub struct Extension<'c> { - /// Enables the -@@ -125,6 +137,10 @@ pub struct Extension<'c> { - /// assert_eq!(markdown_to_html("# README\n", &options), - /// "

README

\n"); - /// ``` -+ #[cfg_attr( -+ all(target_arch = "wasm32", feature = "serde"), -+ serde(rename = "headerIDs") -+ )] - pub header_ids: Option, - - /// Enables the footnotes extension per `cmark-gfm`. -@@ -474,6 +490,7 @@ pub struct Extension<'c> { - /// "

\"\"

\n"); - /// ``` - #[cfg_attr(feature = "arbitrary", arbitrary(value = None))] -+ #[cfg_attr(feature = "serde", serde(skip))] - pub image_url_rewriter: Option>, - - /// Wraps link URLs using a function or custom trait object. -@@ -491,6 +508,7 @@ pub struct Extension<'c> { - /// "

my link

\n"); - /// ``` - #[cfg_attr(feature = "arbitrary", arbitrary(value = None))] -+ #[cfg_attr(feature = "serde", serde(skip))] - pub link_url_rewriter: Option>, - - /// Recognizes many emphasis that appear in CJK contexts but are not recognized by plain CommonMark. -@@ -575,6 +593,11 @@ impl<'c> Extension<'c> { - #[non_exhaustive] - #[derive(Debug, Clone, PartialEq, Eq, Copy)] - #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -+#[cfg_attr( -+ all(target_arch = "wasm32", feature = "serde"), -+ serde(rename_all = "camelCase") -+)] - /// Selects between wikilinks with the title first or the URL first. - pub enum WikiLinksMode { - /// Indicates that the URL precedes the title. For example: `[[http://example.com|link -@@ -610,6 +633,12 @@ where - #[derive(Default, Clone, Debug)] - #[cfg_attr(feature = "bon", derive(Builder))] - #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -+#[cfg_attr(feature = "serde", serde(default))] -+#[cfg_attr( -+ all(target_arch = "wasm32", feature = "serde"), -+ serde(rename_all = "camelCase") -+)] - /// Options for parser functions. - pub struct Parse<'c> { - /// Punctuation (quotes, full-stops and hyphens) are converted into 'smart' punctuation. -@@ -730,6 +759,7 @@ pub struct Parse<'c> { - /// A [broken link] renders as text.

\n"); - /// ``` - #[cfg_attr(feature = "arbitrary", arbitrary(default))] -+ #[cfg_attr(feature = "serde", serde(skip))] - pub broken_link_callback: Option>, - - /// Leave footnote definitions in place in the document tree, rather than -@@ -840,6 +870,7 @@ where - /// Struct to the broken link callback, containing details on the link reference - /// which failed to find a match. - #[derive(Debug)] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] - pub struct BrokenLinkReference<'l> { - /// The normalized reference link label. Unicode case folding is applied; - /// see for a -@@ -853,6 +884,8 @@ pub struct BrokenLinkReference<'l> { - #[derive(Default, Debug, Clone, Copy)] - #[cfg_attr(feature = "bon", derive(Builder))] - #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -+#[cfg_attr(feature = "serde", serde(default))] - /// Options for formatter functions. - pub struct Render { - /// [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) in the input -@@ -884,6 +917,7 @@ pub struct Render { - /// "
fn hello();\n
\n"); - /// ``` - #[cfg_attr(feature = "bon", builder(default))] -+ #[cfg_attr(all(target_arch = "wasm32", feature = "serde"), serde(rename = "githubPreLang"))] - pub github_pre_lang: bool, - - /// Enable full info strings for code blocks -@@ -1161,6 +1195,8 @@ pub struct Render { - - #[derive(Debug, Clone, Copy, Default)] - #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -+#[cfg_attr(all(target_arch = "wasm32", feature = "serde"), serde(rename_all = "camelCase"))] - /// Options for bulleted list rendering in markdown. See `link_style` in [`Render`] for more details. - pub enum ListStyleType { - /// The `-` character diff --git a/patches/comrak-labs/src/parser/phoenix_heex.rs.diff b/patches/comrak-labs/src/parser/phoenix_heex.rs.diff deleted file mode 100644 index ecb11ec..0000000 --- a/patches/comrak-labs/src/parser/phoenix_heex.rs.diff +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/src/parser/phoenix_heex.rs b/src/parser/phoenix_heex.rs -index 047223e..3c0129e 100644 ---- a/src/parser/phoenix_heex.rs -+++ b/src/parser/phoenix_heex.rs -@@ -1,5 +1,9 @@ - /// Represents the type of Phoenix HEEx node. - #[derive(Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub enum HeexNode { - /// A directive like `<% %>` or `<%= %>`. - Directive, -@@ -15,6 +19,10 @@ pub enum HeexNode { - - /// The metadata of a Phoenix HEEx block-level element. - #[derive(Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeHeexBlock { - /// The literal contents of the Phoenix block element, including delimiters. - pub literal: String, diff --git a/patches/comrak-labs/src/parser/shortcodes.rs.diff b/patches/comrak-labs/src/parser/shortcodes.rs.diff deleted file mode 100644 index 51abc7d..0000000 --- a/patches/comrak-labs/src/parser/shortcodes.rs.diff +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/src/parser/shortcodes.rs b/src/parser/shortcodes.rs -index 234b32a..df8e3b0 100644 ---- a/src/parser/shortcodes.rs -+++ b/src/parser/shortcodes.rs -@@ -2,6 +2,10 @@ - /// - /// ("gemoji" name context: https://github.com/github/gemoji) - #[derive(Debug, Clone, PartialEq, Eq)] -+#[cfg_attr( -+ feature = "serde", -+ derive(serde::Serialize, serde::Deserialize) -+)] - pub struct NodeShortCode { - /// The shortcode that was resolved, e.g. "rabbit". - pub code: String, diff --git a/patches/comrak-labs/src/plugins/syntect.rs.diff b/patches/comrak-labs/src/plugins/syntect.rs.diff deleted file mode 100644 index 1d34d8e..0000000 --- a/patches/comrak-labs/src/plugins/syntect.rs.diff +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/plugins/syntect.rs b/src/plugins/syntect.rs -index 63e8837..7f5c1e1 100644 ---- a/src/plugins/syntect.rs -+++ b/src/plugins/syntect.rs -@@ -16,6 +16,7 @@ use crate::adapters::SyntaxHighlighterAdapter; - use crate::html; - - #[derive(Debug)] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] - /// Syntect syntax highlighter plugin. - pub struct SyntectAdapter { - theme: Option, -@@ -185,6 +186,7 @@ impl<'a, 's> Iterator for SyntectPreAttributesIter<'a, 's> { - } - - #[derive(Debug)] -+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] - /// A builder for [`SyntectAdapter`]. - /// - /// Allows customization of `Theme`, [`ThemeSet`], and [`SyntaxSet`]. diff --git a/patches/comrak-labs/src/xml.rs.diff b/patches/comrak-labs/src/xml.rs.diff deleted file mode 100644 index d248a03..0000000 --- a/patches/comrak-labs/src/xml.rs.diff +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/src/xml.rs b/src/xml.rs -index a410e0e..fdba88c 100644 ---- a/src/xml.rs -+++ b/src/xml.rs -@@ -9,12 +9,12 @@ use crate::parser::options::{Options, Plugins}; - - const MAX_INDENT: u32 = 40; - --/// Formats an AST as HTML, modified by the given options. -+/// Formats an AST as XML, modified by the given options. - pub fn format_document(root: Node<'_>, options: &Options, output: &mut dyn Write) -> fmt::Result { - format_document_with_plugins(root, options, output, &Plugins::default()) - } - --/// Formats an AST as HTML, modified by the given options. Accepts custom plugins. -+/// Formats an AST as XML, modified by the given options. Accepts custom plugins. - pub fn format_document_with_plugins( - root: Node<'_>, - options: &Options,