A commonmark viewer for egui
While this crate's main focus is commonmark, it also supports a subset of Github's markdown syntax: tables, strikethrough, tasklists and footnotes.
Usage
In Cargo.toml:
= "0.18"
# Specify what image formats you want to use
= { = "0.25", = false, = ["png"] }
use *;
let markdown =
r"# Hello world
* A list
* [ ] Checkbox
";
let mut cache = default;
new.show;
Compile time evaluation of markdown
If you want to embed markdown directly the binary then you can enable the macros
feature.
This will do the parsing of the markdown at compile time and output egui widgets.
Example
use ;
let mut cache = default;
let _response = commonmark!;
Alternatively you can embed a file
Example
use ;
let mut cache = default;
commonmark_str!;
Features
macros
: macros for compile time parsing of markdownbetter_syntax_highlighting
: Syntax highlighting inside code blocks withsyntect
svg
: Support for viewing svg imagesfetch
: Images with urls will be downloaded and displayed
Examples
For an easy intro check out the hello_world
example. To see all the different
features egui_commonmark has to offer check out the book
example.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.