aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-08 15:52:16 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-08 15:52:16 +0200
commit4c06c8554c35887f8f5147783953b2b7e7c2327f (patch)
tree1b2463848a3ae4c645f7f1a325877ee829ab65c5 /src/parser.rs
downloadmarkdown-rs-4c06c8554c35887f8f5147783953b2b7e7c2327f.tar.gz
markdown-rs-4c06c8554c35887f8f5147783953b2b7e7c2327f.tar.bz2
markdown-rs-4c06c8554c35887f8f5147783953b2b7e7c2327f.zip
.
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs
new file mode 100644
index 0000000..10c6e7a
--- /dev/null
+++ b/src/parser.rs
@@ -0,0 +1,14 @@
+//! Turn a string of markdown into events.
+// To do: this should start with `containers`, when they’re done.
+// To do: definitions and such will mean more data has to be passed around.
+use crate::content::flow::flow;
+use crate::tokenizer::{as_codes, Code, Event};
+
+/// Turn a string of markdown into events.
+/// Passes the codes back so the compiler can access the source.
+pub fn parse(value: &str) -> (Vec<Event>, Vec<Code>) {
+ let codes = as_codes(value);
+ // To do: pass a reference to this around, and slices in the (back)feeding. Might be tough.
+ let events = flow(codes.clone());
+ (events, codes)
+}