1use escpos_md::{MarkdownParser, MarkdownParserOptions, PrinterConfig, Result};
2use std::io;
3
4const TEST_MD: &str = r#"
5# Heading 1
6
7Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec bibendum, turpis vitae feugiat
8
9## Heading 2
10
11This is a paragraph with a __bold value__ as well as an _emphasized value_
12and a ~~strikethrough~~ value and a `code value` and
13the whole thing is split\
14with a hard break and then a horizontal rule
15
16---
17
18This is an unordered list
19
20* With an item
21* And another item
22 * And some nested item
23* And then a not nested item
24 * Nesting Level 2
25 * Nesting Level 3
26* Nesting Level 1
27
28### Heading 3
29
30This is an ordered list
31
321. An item of the list
332. The second item of the list
34 * An unordered bit under the list
353. Third item of the list
36 1. Sub numbers under the list
37 2. Some more numbers
38
39#### Heading 4
40
41And thes are some `code blocks`. For example a much larger code block:
42
43```
44This is something a little bigger
45
46 Maybe with some weird alignments
47```
48
49##### Heading 5
50
51###### Heading 6
52
53And then there's also some block quotes
54
55> Like this block quote example
56> With numerous lines
57
58And of course an image
59
60
61"#;
62
63fn main() -> Result<()> {
64 let mut options = MarkdownParserOptions::empty();
65 options.insert(MarkdownParserOptions::ENABLE_STRIKETHROUGH);
66 let parser = MarkdownParser::new_ext(TEST_MD, options);
67 PrinterConfig::tm_t20ii()
68 .build(io::stdout())?
69 .reset()?
70 .markdown(parser, &Default::default())?
71 .cut()?;
72 Ok(())
73}