diff --git a/src/lib.rs b/src/lib.rs index 7d4ff8b1..1a1a0460 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -92,6 +92,7 @@ pub use parser::parse_document_with_broken_link_callback; pub use parser::{ parse_document, BrokenLinkCallback, BrokenLinkReference, ExtensionOptions, ListStyleType, Options, ParseOptions, Plugins, RenderOptions, RenderPlugins, ResolvedReference, URLRewriter, + WikiLinksMode, }; pub use typed_arena::Arena; pub use xml::format_document as format_xml; diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 1e803383..f2bb7ace 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -200,7 +200,7 @@ where #[derive(Debug, Clone, PartialEq, Eq, Copy)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] /// Selects between wikilinks with the title first or the URL first. -pub(crate) enum WikiLinksMode { +pub enum WikiLinksMode { /// Indicates that the URL precedes the title. For example: `[[http://example.com|link /// title]]`. UrlFirst, diff --git a/src/tests/sourcepos.rs b/src/tests/sourcepos.rs index 3119e3a6..a99e01f9 100644 --- a/src/tests/sourcepos.rs +++ b/src/tests/sourcepos.rs @@ -386,6 +386,15 @@ const ESCAPED_TAG: TestCase = ( after"#, ); +const ALERT: TestCase = ( + &[sourcepos!((2:1-3:9))], + r#"before +> [!note] +> it's on + +after"#, +); + fn node_values() -> HashMap { use NodeValueDiscriminants::*; @@ -407,6 +416,7 @@ fn node_values() -> HashMap { | ThematicBreak // end is 4:0 | Link // inconsistent between link types | Math // is 3:2-3:6 but should be 3:1-3:7 + | Raw // unparseable ) }) .filter_map(|v| { @@ -450,6 +460,8 @@ fn node_values() -> HashMap { Underline => UNDERLINE, SpoileredText => SPOILERED_TEXT, EscapedTag => ESCAPED_TAG, + Alert => ALERT, + Raw => unreachable!(), }; Some((*v, text)) }) @@ -478,9 +490,10 @@ fn sourcepos() { .math_code(true) .math_dollars(true) .multiline_block_quotes(true) - .wikilinks(WikiLinksMode::UrlFirst) + .wikilinks_title_after_pipe(true) .underline(true) .spoiler(true) + .alerts(true) .build(); for (kind, (expecteds, text)) in node_values {