|
1 | 1 | use markdown::{
|
2 |
| - mdast::{Link, Node, Paragraph, Root, Text}, |
| 2 | + mdast::{Image, Link, Node, Paragraph, Root, Text}, |
3 | 3 | to_html, to_html_with_options, to_mdast,
|
4 | 4 | unist::Position,
|
5 | 5 | CompileOptions, Options,
|
@@ -511,5 +511,27 @@ fn link_resource() -> Result<(), String> {
|
511 | 511 | "should support link (resource) as `Link`s in mdast"
|
512 | 512 | );
|
513 | 513 |
|
| 514 | + assert_eq!( |
| 515 | + to_mdast("[](url)", &Default::default())?, |
| 516 | + Node::Root(Root { |
| 517 | + children: vec![Node::Paragraph(Paragraph { |
| 518 | + children: vec![Node::Link(Link { |
| 519 | + children: vec![Node::Image(Image { |
| 520 | + alt: "name".into(), |
| 521 | + url: "image".into(), |
| 522 | + title: None, |
| 523 | + position: Some(Position::new(1, 2, 1, 1, 16, 15)), |
| 524 | + }),], |
| 525 | + url: "url".into(), |
| 526 | + title: None, |
| 527 | + position: Some(Position::new(1, 1, 0, 1, 22, 21)), |
| 528 | + }),], |
| 529 | + position: Some(Position::new(1, 1, 0, 1, 22, 21)), |
| 530 | + }),], |
| 531 | + position: Some(Position::new(1, 1, 0, 1, 22, 21)) |
| 532 | + }), |
| 533 | + "should support nested links in mdast" |
| 534 | + ); |
| 535 | + |
514 | 536 | Ok(())
|
515 | 537 | }
|
0 commit comments