Skip to content

Commit

Permalink
bring in line with latest main.
Browse files Browse the repository at this point in the history
  • Loading branch information
kivikakk committed Feb 22, 2025
1 parent 8a153c6 commit 6282d75
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 14 additions & 1 deletion src/tests/sourcepos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<NodeValueDiscriminants, TestCase> {
use NodeValueDiscriminants::*;

Expand All @@ -407,6 +416,7 @@ fn node_values() -> HashMap<NodeValueDiscriminants, TestCase> {
| 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| {
Expand Down Expand Up @@ -450,6 +460,8 @@ fn node_values() -> HashMap<NodeValueDiscriminants, TestCase> {
Underline => UNDERLINE,
SpoileredText => SPOILERED_TEXT,
EscapedTag => ESCAPED_TAG,
Alert => ALERT,
Raw => unreachable!(),
};
Some((*v, text))
})
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6282d75

Please sign in to comment.