mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
Add syntax highlighing feature to egui_extras (#3333)
* Add syntax highlighing feature to egui_extras Enable "syntect" feature for great syntax highlighting of any language. If not a simple fallback is used that works fine for C++, Rust, Python * Check --no-default-features of egui_extras on CI * spelling * Fix building egui_extras without additional features
This commit is contained in:
@@ -15,11 +15,17 @@
|
||||
mod color_test;
|
||||
mod demo;
|
||||
pub mod easy_mark;
|
||||
pub mod syntax_highlighting;
|
||||
|
||||
pub use color_test::ColorTest;
|
||||
pub use demo::DemoWindows;
|
||||
|
||||
/// View some Rust code with syntax highlighting and selection.
|
||||
pub(crate) fn rust_view_ui(ui: &mut egui::Ui, code: &str) {
|
||||
let language = "rs";
|
||||
let theme = egui_extras::syntax_highlighting::CodeTheme::from_memory(ui.ctx());
|
||||
egui_extras::syntax_highlighting::code_view_ui(ui, &theme, code, language);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// Create a [`Hyperlink`](egui::Hyperlink) to this egui source code file on github.
|
||||
|
||||
Reference in New Issue
Block a user