@@ -222,7 +222,7 @@ pub struct Extension<'c> {
222222 /// let mut options = Options::default();
223223 /// options.extension.front_matter_delimiter = Some("---".to_owned());
224224 /// let arena = Arena::new();
225- /// let input ="---\nlayout: post\n---\nText\n";
225+ /// let input = "---\nlayout: post\n---\nText\n";
226226 /// let root = parse_document(&arena, input, &options);
227227 /// let mut buf = String::new();
228228 /// format_commonmark(&root, &options, &mut buf);
@@ -697,8 +697,54 @@ pub struct Parse<'c> {
697697 /// "<h1>Cool input!</h1>\n<p>Wow look at this cool \
698698 /// <a href=\"https://www.rust-lang.org/\" title=\"The Rust Language\">link</a>. \
699699 /// A [broken link] renders as text.</p>\n");
700+ /// ```
700701 #[ cfg_attr( feature = "arbitrary" , arbitrary( default ) ) ]
701702 pub broken_link_callback : Option < Arc < dyn BrokenLinkCallback + ' c > > ,
703+
704+ /// Leave footnote definitions in place in the document tree, rather than
705+ /// reordering them to the end. This will also cause unreferenced footnote
706+ /// definitions to remain in the tree, rather than being removed.
707+ ///
708+ /// Comrak's default formatters expect this option to be turned off, so use
709+ /// with care if you use the default formatters.
710+ ///
711+ /// ```rust
712+ /// # use comrak::{Arena, parse_document, Node, Options};
713+ /// let mut options = Options::default();
714+ /// options.extension.footnotes = true;
715+ /// let arena = Arena::new();
716+ /// let input = concat!(
717+ /// "Remember burning a CD?[^cd]\n",
718+ /// "\n",
719+ /// "[^cd]: In the Old Days, a 4x burner was considered good.\n",
720+ /// "\n",
721+ /// "[^dvd]: And DVD-RWs? Those were something else.\n",
722+ /// "\n",
723+ /// "Me neither.",
724+ /// );
725+ ///
726+ /// fn node_kinds<'a>(doc: Node<'a>) -> Vec<&'static str> {
727+ /// doc.descendants().map(|n| n.data().value.xml_node_name()).collect()
728+ /// }
729+ ///
730+ /// let root = parse_document(&arena, input, &options);
731+ /// assert_eq!(
732+ /// node_kinds(root),
733+ /// &["document", "paragraph", "text", "footnote_reference", "paragraph", "text",
734+ /// "footnote_definition", "paragraph", "text"],
735+ /// );
736+ ///
737+ /// options.parse.leave_footnote_definitions = true;
738+ ///
739+ /// let root = parse_document(&arena, input, &options);
740+ /// assert_eq!(
741+ /// node_kinds(root),
742+ /// &["document", "paragraph", "text", "footnote_reference", "footnote_definition",
743+ /// "paragraph", "text", "footnote_definition", "paragraph", "text", "paragraph", "text"],
744+ /// );
745+ /// ```
746+ #[ cfg_attr( feature = "bon" , builder( default ) ) ]
747+ pub leave_footnote_definitions : bool ,
702748}
703749
704750/// The type of the callback used when a reference link is encountered with no
0 commit comments