aboutsummaryrefslogtreecommitdiffstats
path: root/readme.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--readme.md30
1 files changed, 25 insertions, 5 deletions
diff --git a/readme.md b/readme.md
index 91b7985..1afce35 100644
--- a/readme.md
+++ b/readme.md
@@ -92,17 +92,14 @@ Extensions (in this case GFM):
```rs
extern crate micromark;
-use micromark::{micromark_with_options, Constructs, Options};
+use micromark::{micromark_with_options, Options};
fn main() -> Result<(), String> {
println!(
"{}",
micromark_with_options(
"* [x] contact@example.com ~~strikethrough~~",
- &Options {
- constructs: Constructs::gfm(),
- ..Options::default()
- }
+ &Options::gfm()
)?
);
@@ -122,6 +119,29 @@ Yields:
</ul>
```
+Syntax tree:
+
+```rs
+extern crate micromark;
+use micromark::{micromark_to_mdast, ParseOptions};
+
+fn main() -> Result<(), String> {
+ println!(
+ "{:?}",
+ micromark_to_mdast("# Hey, *you*!", &ParseOptions::default())?
+ );
+
+ Ok(())
+}
+```
+
+Yields:
+
+```text
+Root { children: [Heading { children: [Text { value: "Hey, ", position: Some(1:3-1:8 (2-7)) }, Emphasis { children: [Text { value: "you", position: Some(1:9-1:12 (8-11)) }], position: Some(1:8-1:13 (7-12)) }, Text { value: "!", position: Some(1:13-1:14 (12-13)) }], position: Some(1:1-1:14 (0-13)), depth: 1 }], position: Some(1:1-1:14 (0-13)) }
+
+```
+
## API
`micromark` exposes