diff --git a/src/interpreter/snapshots/inlyne__interpreter__tests__bare_link_gets_autolinked.snap b/src/interpreter/snapshots/inlyne__interpreter__tests__bare_link_gets_autolinked.snap new file mode 100644 index 00000000..fa3784f1 --- /dev/null +++ b/src/interpreter/snapshots/inlyne__interpreter__tests__bare_link_gets_autolinked.snap @@ -0,0 +1,56 @@ +--- +source: src/interpreter/tests.rs +description: " --- md\n\nIn a paragraph https://example.org\n\n- In a list https://example.org\n\n\n --- html\n\n

In a paragraph https://example.org

\n\n" +expression: interpret_md(text) +--- +[ + TextBox( + TextBox { + texts: [ + Text { + text: "In a paragraph ", + default_color: Color(BLACK), + .. + }, + Text { + text: "https://example.org", + color: Some(Color { r: 0.09, g: 0.13, b: 1.00 }), + link: Some("https://example.org"), + .. + }, + ], + .. + }, + ), + Spacer( + InvisibleSpacer(5), + ), + TextBox( + TextBox { + indent: 50.0, + texts: [ + Text { + text: "ยท ", + default_color: Color(BLACK), + style: BOLD , + .. + }, + Text { + text: "In a list ", + default_color: Color(BLACK), + .. + }, + Text { + text: "https://example.org", + color: Some(Color { r: 0.09, g: 0.13, b: 1.00 }), + link: Some("https://example.org"), + .. + }, + ], + .. + }, + ), + Spacer( + InvisibleSpacer(5), + ), +] diff --git a/src/interpreter/tests.rs b/src/interpreter/tests.rs index 2324441d..73e6e468 100644 --- a/src/interpreter/tests.rs +++ b/src/interpreter/tests.rs @@ -149,10 +149,17 @@ Fenced code block with no language tag fn main() {} ```"; +const BARE_LINK_GETS_AUTOLINKED: &str = "\ +In a paragraph https://example.org + +- In a list https://example.org +"; + snapshot_interpreted_elements!( (footnotes_list_prefix, FOOTNOTES_LIST_PREFIX), (checklist_has_no_text_prefix, CHECKLIST_HAS_NO_TEXT_PREFIX), (code_block_bg_color, CODE_BLOCK_BG_COLOR), + (bare_link_gets_autolinked, BARE_LINK_GETS_AUTOLINKED), ); /// Spin up a server, so we can test network requests without external services diff --git a/src/utils.rs b/src/utils.rs index 3e73e360..4969bc91 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -79,6 +79,7 @@ impl From for HoverInfo { pub fn markdown_to_html(md: &str, syntax_theme: SyntectTheme) -> String { let mut options = ComrakOptions::default(); + options.extension.autolink = true; options.extension.table = true; options.extension.strikethrough = true; options.extension.tasklist = true;