mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
updated bold in render to use MarkdownV2 style
updated `Renderer::as_markdown` comment to explicitly say the output is in MarkdownV2 style
This commit is contained in:
parent
94db1757dc
commit
167f44442e
2 changed files with 6 additions and 6 deletions
|
@ -140,7 +140,7 @@ impl<'a> Renderer<'a> {
|
|||
self.format(&html::HTML)
|
||||
}
|
||||
|
||||
/// Renders and returns the text as a **Markdown-formatted** string.
|
||||
/// Renders and returns the text as a **MarkdownV2-formatted** string.
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn as_markdown(&self) -> String {
|
||||
|
@ -164,7 +164,7 @@ mod test {
|
|||
let render = Renderer::new(text, &entities);
|
||||
|
||||
assert_eq!(render.as_html(), "<b>Bold</b> <i>italic</i> <u><underline</u>_");
|
||||
assert_eq!(render.as_markdown(), "**Bold** _\ritalic_\r __\r<underline__\r\\_");
|
||||
assert_eq!(render.as_markdown(), "*Bold* _\ritalic_\r __\r<underline__\r\\_");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -204,7 +204,7 @@ mod test {
|
|||
let render = Renderer::new(text, &entities);
|
||||
|
||||
assert_eq!(render.as_html(), "Some <b>bold <i>both</b> italics</i>");
|
||||
assert_eq!(render.as_markdown(), "Some **bold _\rboth** italics_\r");
|
||||
assert_eq!(render.as_markdown(), "Some *bold _\rboth* italics_\r");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -243,8 +243,8 @@ mod test {
|
|||
);
|
||||
assert_eq!(
|
||||
render.as_markdown(),
|
||||
"**Hi** _\rhow_\r __\rare__\r ~you~?\n**n****__\r~este~__\rd** [entities](https://t.me/) \
|
||||
[are](tg://user?id=1234567) `cool`\n>Im in a Blockquote\\!"
|
||||
"*Hi* _\rhow_\r __\rare__\r ~you~?\n*n**__\r~este~__\rd* [entities](https://t.me/) \
|
||||
[are](tg://user?id=1234567) `cool`\n>Im in a Blockquote\\!"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::utils::markdown::ESCAPE_CHARS;
|
|||
use super::{ComplexTag, Kind, Place, SimpleTag, Tag, TagWriter};
|
||||
|
||||
pub static MARKDOWN: TagWriter = TagWriter {
|
||||
bold: SimpleTag::new("**", "**"),
|
||||
bold: SimpleTag::new("*", "*"),
|
||||
blockquote: SimpleTag::new(">", ""),
|
||||
italic: SimpleTag::new("_\r", "_\r"),
|
||||
underline: SimpleTag::new("__\r", "__\r"),
|
||||
|
|
Loading…
Reference in a new issue