百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

egui_commonmark

> 编程语言
开源

egui 的 Markdown 视图器

176 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

egui 的 Markdown 视图器

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:

toml
egui_commonmark = "0.25"
# Specify what image formats you want to use
image = { version = "0.25", default-features = false, features = ["png"] }
rust
use egui_commonmark::*;
let markdown =
r"# Hello world

* A list
* [ ] Checkbox
";

let mut cache = CommonMarkCache::default();
CommonMarkViewer::new().show(ui, &mut cache, markdown);

Compile time evaluation of markdown

If you want to embed markdown directly into 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

rust
use egui_commonmark::{CommonMarkCache, commonmark};
let mut cache = CommonMarkCache::default();
let _response = commonmark!(ui, &mut cache, "# ATX Heading Level 1");

Alternatively you can embed a file

Example

rust
use egui_commonmark::{CommonMarkCache, commonmark_str};
let mut cache = CommonMarkCache::default();
commonmark_str!(ui, &mut cache, "content.md");

Features

  • macros: macros for compile time parsing of markdown
  • better_syntax_highlighting: Syntax highlighting inside code blocks with syntect
  • svg: Support for viewing svg images
  • fetch: Images with urls will be downloaded and displayed
  • embedded_image: Load base64 image data urls from within markdown files

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.

FAQ

URL is not displayed when hovering over a link

By default egui does not show urls when you hover hyperlinks. To enable it, you can do the following before calling any ui related functions:

rust
ui.style_mut().url_in_tooltip = true;

MSRV Policy

This crate uses the same MSRV as the latest released egui version.

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.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustcommonmarkeguimarkdownrust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言