marcus 0.1.2

An experimental Markdown parser written in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::helpers::{escape, re};
use regex::Captures;

pub fn default(html: &mut String) {
  // Parse: Auto links
  re::parse(html, re::from(re::AUTO_LINK), | capture: Captures |
    format!("<a href=\"{link}\">{link}</a>", link = &capture[1])
  );

  // Parse: Auto emails (email validation regex source: https://emailregex.com/)
  re::parse(html, re::from(re::AUTO_LINK_EMAIL), | capture: Captures |
    format!("<a href=\"mailto:{email}\">{email}</a>", email = escape::ascii(&capture[1]))
  );
}