vertigo-cmark
Converts CommonMark string into rendered vertigo DomElement.
See Changelog for recent features.
Example
Dependencies:
= "0.14"
= "0.1"
use ;
const CONTENT: &str = r#"
# Hello world
## Paragraph
Lorem ipsum dolor sit amet, __consectetur__ adipiscing elit, sed do
```eiusmod tempor incididunt```
ut *labore* et dolore magna aliqua.
## List
* Lorem ipsum
* dolor sit amet
* consectetur adipiscing elit
## Table
| Lorem | Ipsum |
| --------------- | -------------- |
| dolor sit amet | consectetur |
| adipiscing elit | sed do eiusmod |
"#;

Features
- Regular, bod, italic, strike-through text
- Headings
- Paragraphs
- Tables
- Blockquotes
- Codeblocks
- Code highlighting (with
syntectfeature) - Lists (numbers, bullets)
- Rules
- Task list markers
- Footnotes
- Soft/hard breaks
- Links
- Images
- Html (with
htmlfeature), sanitized by default
Security
Markdown can carry raw HTML and links to any address, and vertigo-cmark builds
DOM from them directly — there is no HTML string to clean afterwards. So by
default everything goes through SafeHtml: elements and attributes from
ammonia's default whitelist and links and images only with safe schemes.
Scripts, styles, event handlers, frames, forms and javascript: addresses
don't get into the page, so rendering text from users is safe.
For content you control, TrustedHtml renders everything as written. Anything
in between is an own HtmlPolicy — usually delegating to SafeHtml all but
a few elements:
use Cow;
use ;
/// Safe HTML plus YouTube players.
;
let content = events_to_vertigo;