docs.rs failed to build ferogram-parsers-0.3.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
ferogram-parsers
Telegram HTML and Markdown entity parsers for ferogram.
Converts Telegram-flavoured Markdown and HTML to and from MessageEntity vectors. Extracted in v0.3.0; ferogram re-exports everything via ferogram::parsers.
Can be used standalone by any crate that works with Telegram formatted text.
Installation
[]
= "0.3"
Usage
Markdown
use ;
let = parse_markdown;
// text = "bold and italic"
// entities = [Bold(0..4), Italic(9..15)]
let md = generate_markdown;
// md = "**bold** and __italic__"
Supported syntax:
| Syntax | Entity |
|---|---|
**bold** or *bold* |
Bold |
__italic__ or _italic_ |
Italic |
~~strike~~ |
Strikethrough |
||spoiler|| |
Spoiler |
`code` |
Code |
```lang\npre\n``` |
Pre (code block) |
[text](url) |
TextUrl |
[text](tg://user?id=123) |
MentionName |
 |
CustomEmoji |
\*, \_, \~ ... |
Escaped literal char |
HTML
use ;
let = parse_html;
// text = "Hello world"
// entities = [Bold(0..5), Italic(6..11)]
let html = generate_html;
// html = "<b>Hello</b> <i>world</i>"
Supported tags: <b>, <strong>, <i>, <em>, <u>, <s>, <del>, <code>, <pre>, <tg-spoiler>, <a href="url">, <tg-emoji emoji-id="id">
Feature flags
| Flag | What it enables |
|---|---|
html5ever |
Replaces parse_html with a spec-compliant html5ever tokenizer |
By default parse_html uses the built-in hand-rolled parser (zero extra dependencies). Enable html5ever for strict HTML5 conformance.
= { = "0.3", = ["html5ever"] }
Stack position
ferogram
└ ferogram-parsers <-- here
└ ferogram-tl-types (tl-api feature)
License
MIT or Apache-2.0, at your option. See LICENSE-MIT and LICENSE-APACHE.
Ankit Chaubey - github.com/ankit-chaubey