1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-03-04 18:02:24 +00:00

added support of strikethrough and underline

This commit is contained in:
2020-01-02 23:10:30 +06:00
parent bba37d8889
commit e7495468a2
7 changed files with 65 additions and 1 deletions

View File

@@ -41,6 +41,19 @@ fun String.preHTML(): String = htmlDefault(htmlPreControl)
fun String.emailMarkdown(): String = linkMarkdown("mailto://$this")
fun String.emailHTML(): String = linkHTML("mailto://$this")
/**
* Crutch for support of strikethrough in default markdown. Simply add modifier, but it will not look like correct
*/
fun String.strikethroughMarkdown(): String = map { it + "\u0336" }.joinToString("")
fun String.strikethroughHTML(): String = htmlDefault("s")
/**
* Crutch for support of underline in default markdown. Simply add modifier, but it will not look like correct
*/
fun String.underlineMarkdown(): String = map { it + "\u0347" }.joinToString("")
fun String.underlineHTML(): String = htmlDefault("u")
private inline infix fun String.mention(adapt: String.() -> String): String = if (startsWith("@")) {
this