- Headings are unchanged from vanilla markdown (6 levels).
- Paragraphs are unchanged from vanilla markdown.
-- Ordered lists are unchanged from vanilla markdown.
- URLs and email addresses are unchanged from vanilla markdown.
- Images are unchanged from vanilla markdown.
- Inline code with the backtick character is unchanged from vanilla markdown.
- Bold styling will work only with a single asterisk character.
- Italic styling will work only with a single underscore character.
- Unordered lists will work only with the hyphen character.
+- Ordered lists will work only with the period character.
-1. Ordered
-2. Lists
-3. Are
-4. As
-5. Written
+. Test
+. Of
+. Ordered
+. List
### Macros
document.push(Box::new(Heading{text: line[1..].to_string(), level: 1}))
},
- // match all unordered list patterns
- ('-', ..) => {
+ // match all list patterns
+ ('-', ..) | ('.', ..) => {
+ let matching = &line[..1];
let mut items: Vec<Item> = vec![Item{text: line[1..].to_string()}];
- while lines.peek() != None && lines.peek() != Some(&"") && &lines.peek().unwrap()[..1] == "-" {
- items.push(Item{text: lines.next().unwrap()[1..].to_string()});
- }
- document.push(Box::new(List{items, ordered: false}))
- }
-
- // match all ordered list patterns (matches up to 999. ...)
- ('1'..='9', '.', ..) | ('1'..='9', '1'..='9', '.', ..) | ('1'..='9', '1'..='9', '1'..='9', '.', ..) => {
- let mut items: Vec<Item> = vec![Item{text: line.split_once(".").unwrap().1.to_string()}];
while match lines.peek() {
Some(string) => {
if string == &"" {false}
else {
- let re = Regex::new(r"\d*.").unwrap();
- re.is_match_at(string, 0)
+ &string[..1] == matching
}
},
None => false
} {
- match lines.next().unwrap().split_once(".") {
- Some((_, text)) => {items.push(Item{text: text.to_string()});},
- None => ()
- }
+ items.push(Item{text: lines.next().unwrap()[1..].to_string()});
}
- document.push(Box::new(List{items, ordered: true}))
+ document.push(Box::new(List{items, ordered: matching == "."}))
}
// match all insert sequences like the title