10
0
Fork
You've already forked style-parser
0
No description
Python 56.8%
Rust 43.2%
nicoco 962d085a80
All checks were successful
ci/woodpecker/push/woodpecker/2 Pipeline was successful
ci/woodpecker/push/woodpecker/1 Pipeline was successful
ci/woodpecker/push/woodpecker/3 Pipeline was successful
ci/woodpecker/push/woodpecker/5 Pipeline was successful
ci/woodpecker/push/woodpecker/4 Pipeline was successful
ci/woodpecker/push/woodpecker/6 Pipeline was successful
docs: improve README
2025年04月10日 09:38:04 +02:00
src fix compiler warnings 2024年08月28日 02:52:50 -05:00
tests update matrix tests to use <s> 2024年08月28日 02:51:02 -05:00
.gitignore build: switch to setuptools-rust, -scm, and uv 2025年04月09日 22:00:42 +02:00
.woodpecker.yaml build: switch to setuptools-rust, -scm, and uv 2025年04月09日 22:00:42 +02:00
Cargo.lock update dependencies, bump version 2025年04月07日 10:09:35 -05:00
Cargo.toml update dependencies, bump version 2025年04月07日 10:09:35 -05:00
LICENSE add AGPL license 2023年12月09日 15:21:19 -06:00
pyproject.toml build: switch to setuptools-rust, -scm, and uv 2025年04月09日 22:00:42 +02:00
README.md docs: improve README 2025年04月10日 09:38:04 +02:00

Slidge-style-parser

PyPI version

License: AGPL-3.0-or-later

A parsing library for Slidge. Supports parsing these attributes:

  • "_underline_"

  • "*bold*"

  • "~strikethrough~"

  • "`code span`"

  • "```language

    code block

    ```"

  • ">quote"

  • "||spoiler||"

  • "\_escape style_"

Most of them correspond to XEP-0393: Message Styling.

Methods:


format_for_telegram(body: String, mentions: Optional<(_, start, end_index_exclusive)>)
 -> (body: String, Vec<(format: String, offset: usize, length: usize, language: String)>)
format_for_matrix(body: String, mentions: Optional<(mxid, start, end_index_exclusive)>) -> body: String
format_body(body: String, new_tags: HashMap<String, (String, String)>) -> String
new_tags = {
 "_": ("<em>", "</em>"),
 "*": ("<strong>", "</strong>"), 
 "~": ("<del>", "</del>"),
 "`": ("<code>", "</code>"),
 "```": ("<pre><code>", "</code></pre>"),
 "```language": ('<pre><code class="language-{}">', "</code></pre>"),
 ">": ("<blockquote>", "</blockquote>"),
 "||": ("<span data-mx-spoiler>", "</span>"),
 "\n": ("<br>", "")
}

To build: uv build or any other PEP517-compliant tool