wayver's git archive


an obsidian renderer
git clone https://git.wayver.dev/sable

sable-markdown/src/parser/inline/tests/inline_link.rs@337ba67f65eaa17b44e371af7c0f0c761d6aa914

raw
Date Commit Message Author Files + -
2026-02-23 01:55 initial mvp wayverd 139 17808 0
...

1use crate::{ast::*, parser::parse_markdown};
2
3#[test]
4fn inline_link1() {
5    let doc = parse_markdown("[foo](/url \"title\")").unwrap();
6    assert_eq!(
7        doc,
8        Document {
9            blocks: vec![Block::Paragraph(vec![Inline::Link(Link {
10                destination: "/url".to_owned(),
11                title: Some("title".to_owned()),
12                children: vec![Inline::Text("foo".to_owned())]
13            })])]
14        }
15    );
16}
17
18#[test]
19fn inline_link2() {
20    let doc = parse_markdown("[foo](train.jpg)").unwrap();
21    assert_eq!(
22        doc,
23        Document {
24            blocks: vec![Block::Paragraph(vec![Inline::Link(Link {
25                destination: "train.jpg".to_owned(),
26                title: None,
27                children: vec![Inline::Text("foo".to_owned())]
28            })])]
29        }
30    );
31}
32
33#[test]
34fn inline_link3() {
35    let doc = parse_markdown("[foo](<url>)").unwrap();
36    assert_eq!(
37        doc,
38        Document {
39            blocks: vec![Block::Paragraph(vec![Inline::Link(Link {
40                destination: "url".to_owned(),
41                title: None,
42                children: vec![Inline::Text("foo".to_owned())]
43            })])]
44        }
45    );
46}
47