wayver's git archive


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

sable-markdown/src/parser/inline/tests/image.rs@2b84405277e54ab809e328cf0237374d4b4dbd0c

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 image1() {
5    let doc = parse_markdown("![foo](/url \"title\")").unwrap();
6    assert_eq!(
7        doc,
8        Document {
9            blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
10                destination: "/url".to_owned(),
11                title: Some("title".to_owned()),
12                alt: "foo".to_owned(),
13            })])]
14        }
15    );
16}
17
18#[test]
19fn image2() {
20    let doc = parse_markdown("![foo](train.jpg)").unwrap();
21    assert_eq!(
22        doc,
23        Document {
24            blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
25                destination: "train.jpg".to_owned(),
26                title: None,
27                alt: "foo".to_owned(),
28            })])]
29        }
30    );
31}
32
33#[test]
34fn image3() {
35    let doc = parse_markdown("![foo](<url>)").unwrap();
36    assert_eq!(
37        doc,
38        Document {
39            blocks: vec![Block::Paragraph(vec![Inline::Image(Image {
40                destination: "url".to_owned(),
41                title: None,
42                alt: "foo".to_owned(),
43            })])]
44        }
45    );
46}
47