use crate::markdown::BulletStyle;
pub trait Mapper {
fn link_desc_open(&self) -> &str {
"["
}
fn link_desc_close(&self) -> &str {
"]"
}
fn link_url_open(&self) -> &str {
"("
}
fn link_url_close(&self) -> &str {
")"
}
fn blockquote_bar(&self) -> &str {
"> "
}
fn unordered_bullet(&self, style: BulletStyle) -> &str {
match style {
BulletStyle::Dash => "- ",
BulletStyle::Star => "* ",
BulletStyle::Plus => "+ ",
}
}
fn ordered_marker(&self, num: u32) -> String {
format!("{}. ", num)
}
fn task_checked(&self) -> &str {
"[x] "
}
fn task_unchecked(&self) -> &str {
"[ ] "
}
fn table_vertical(&self) -> &str {
"|"
}
fn table_horizontal(&self) -> &str {
"-"
}
fn table_top_left(&self) -> &str {
"+"
}
fn table_top_right(&self) -> &str {
"+"
}
fn table_bottom_left(&self) -> &str {
"+"
}
fn table_bottom_right(&self) -> &str {
"+"
}
fn table_top_junction(&self) -> &str {
"+"
}
fn table_bottom_junction(&self) -> &str {
"+"
}
fn table_left_junction(&self) -> &str {
"+"
}
fn table_right_junction(&self) -> &str {
"+"
}
fn table_cross(&self) -> &str {
"+"
}
fn horizontal_rule_char(&self) -> &str {
"-"
}
fn emphasis_open(&self) -> &str {
"*"
}
fn emphasis_close(&self) -> &str {
"*"
}
fn strong_open(&self) -> &str {
"**"
}
fn strong_close(&self) -> &str {
"**"
}
fn code_open(&self) -> &str {
"`"
}
fn code_close(&self) -> &str {
"`"
}
fn strikethrough_open(&self) -> &str {
"~~"
}
fn strikethrough_close(&self) -> &str {
"~~"
}
fn hide_urls(&self) -> bool {
false
}
fn has_text_size_protocol(&self) -> bool {
false
}
}
#[derive(Debug, Clone, Copy, Default)]
pub struct DefaultMapper;
impl Mapper for DefaultMapper {}
#[derive(Debug, Clone, Copy, Default)]
pub struct StyledMapper;
impl Mapper for StyledMapper {
fn link_desc_open(&self) -> &str {
"▐"
}
fn link_desc_close(&self) -> &str {
"▌"
}
fn link_url_open(&self) -> &str {
"◖"
}
fn link_url_close(&self) -> &str {
"◗"
}
fn blockquote_bar(&self) -> &str {
"▌ "
}
fn horizontal_rule_char(&self) -> &str {
"─"
}
fn task_checked(&self) -> &str {
"[✓] "
}
fn table_vertical(&self) -> &str {
"│"
}
fn table_horizontal(&self) -> &str {
"─"
}
fn table_top_left(&self) -> &str {
"┌"
}
fn table_top_right(&self) -> &str {
"┐"
}
fn table_bottom_left(&self) -> &str {
"└"
}
fn table_bottom_right(&self) -> &str {
"┘"
}
fn table_top_junction(&self) -> &str {
"┬"
}
fn table_bottom_junction(&self) -> &str {
"┴"
}
fn table_left_junction(&self) -> &str {
"├"
}
fn table_right_junction(&self) -> &str {
"┤"
}
fn table_cross(&self) -> &str {
"┼"
}
fn emphasis_open(&self) -> &str {
""
}
fn emphasis_close(&self) -> &str {
""
}
fn strong_open(&self) -> &str {
""
}
fn strong_close(&self) -> &str {
""
}
fn code_open(&self) -> &str {
""
}
fn code_close(&self) -> &str {
""
}
fn strikethrough_open(&self) -> &str {
""
}
fn strikethrough_close(&self) -> &str {
""
}
}