Metadata-Version: 2.4
Name: slidge-style-parser
Version: 0.1.9
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
License-File: LICENSE
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/BluebonnetField/slidge-style-parser
Project-URL: Repository, https://github.com/BluebonnetField/slidge-style-parser

[Github](https://github.com/BluebonnetField/slidge-style-parser)

[PyPi](https://pypi.org/project/slidge-style-parser/)

License: AGPL-3.0-or-later

A parsing library for [Slidge](https://sr.ht/~nicoco/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](https://xmpp.org/extensions/xep-0393.html).

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: `maturin build`

