Markdown parser fork with extended syntax for personal use.
1use markdown::{
2 mdast::{Node, Root},
3 message, to_html, to_mdast,
4 unist::Position,
5};
6use pretty_assertions::assert_eq;
7
8#[test]
9fn zero() -> Result<(), message::Message> {
10 assert_eq!(to_html(""), "", "should support no markdown");
11
12 assert_eq!(
13 to_html("asd\0asd"),
14 "<p>asd�asd</p>",
15 "should replace `\\0` w/ a replacement characters (`�`)"
16 );
17
18 assert_eq!(
19 to_html("�"),
20 "<p>�</p>",
21 "should replace NUL in a character reference"
22 );
23
24 // This doesn’t make sense in markdown, as character escapes only work on
25 // ascii punctuation, but it’s good to demonstrate the behavior.
26 assert_eq!(
27 to_html("\\0"),
28 "<p>\\0</p>",
29 "should not support NUL in a character escape"
30 );
31
32 assert_eq!(
33 to_mdast("", &Default::default())?,
34 Node::Root(Root {
35 children: vec![],
36 position: Some(Position::new(1, 1, 0, 1, 1, 0))
37 }),
38 "should support no markdown (ast)"
39 );
40
41 Ok(())
42}