diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2022-08-25 21:09:25 +1200 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2022-08-25 21:09:25 +1200 |
commit | 54f5e9fd883e207931baa9c87b6181ca724d6bab (patch) | |
tree | 17111a1da036dbc061ae4062ea0716373e16e23d /src/text.rs | |
download | markdown-54f5e9fd883e207931baa9c87b6181ca724d6bab.zip |
Initial commit
Diffstat (limited to 'src/text.rs')
-rw-r--r-- | src/text.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/text.rs b/src/text.rs new file mode 100644 index 0000000..e9dbdeb --- /dev/null +++ b/src/text.rs @@ -0,0 +1,30 @@ +pub enum Text { + Normal(String), + Bold(String), + Italic(String), + BoldItalic(String), + Code(String), + WikiLink(String), + Hyperlink(Hyperlink), +} +impl std::fmt::Debug for Text { + fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + let string = match self { + Text::Normal(text) => format!("Normal ('{}')", text), + Text::Bold(text) => format!("Bold ('{}')", text), + Text::Italic(text) => format!("Italic ('{}')", text), + Text::BoldItalic(text) => format!("BoldItalic ('{}')", text), + Text::Code(text) => format!("Code ('{}')", text), + Text::WikiLink(text) => format!("WikiLink ('{}')", text), + Text::Hyperlink(Hyperlink { label, target }) => { + format!("Hyperlink (label:'{}', target:'{}')", label, target) + } + }; + f.write_str(&string) + } +} + +pub struct Hyperlink { + pub label: String, + pub target: String, +} |