Skip to content

Commit

Permalink
Inform about url_in_tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
lampsitter committed Jun 1, 2024
1 parent 4a7dad6 commit 0125b07
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1 deletion.
4 changes: 4 additions & 0 deletions egui_commonmark/examples/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ fn main() {
cc.egui_ctx.set_visuals(egui::Visuals::dark());
}
}
cc.egui_ctx.style_mut(|style| {
// Show the url of a hyperlink on hover
style.url_in_tooltip = true;
});

Box::new(App {
cache: CommonMarkCache::default(),
Expand Down
5 changes: 5 additions & 0 deletions egui_commonmark/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ fn main() {
}
}

cc.egui_ctx.style_mut(|style| {
// Show the url of a hyperlink on hover
style.url_in_tooltip = true;
});

Box::new(App {
cache: CommonMarkCache::default(),
})
Expand Down
6 changes: 6 additions & 0 deletions egui_commonmark/examples/link_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ fn main() {
}
}

cc.egui_ctx.style_mut(|style| {
// Show the url of a hyperlink on hover. The demonstration of
// the link hooks would be a little pointless without this
style.url_in_tooltip = true;
});

let mut cache = CommonMarkCache::default();
cache.add_link_hook("#next");
cache.add_link_hook("#prev");
Expand Down
5 changes: 5 additions & 0 deletions egui_commonmark/examples/macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ fn main() {
}
}

cc.egui_ctx.style_mut(|style| {
// Show the url of a hyperlink on hover
style.url_in_tooltip = true;
});

Box::new(App {
cache: CommonMarkCache::default(),
})
Expand Down
5 changes: 5 additions & 0 deletions egui_commonmark/examples/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ fn main() {
}
}

cc.egui_ctx.style_mut(|style| {
// Show the url of a hyperlink on hover
style.url_in_tooltip = true;
});

Box::new(App {
cache: CommonMarkCache::default(),
})
Expand Down
5 changes: 5 additions & 0 deletions egui_commonmark/examples/show_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ fn main() {
}
}

cc.egui_ctx.style_mut(|style| {
// Show the url of a hyperlink on hover
style.url_in_tooltip = true;
});

Box::new(App {
cache: CommonMarkCache::default(),
text_buffer: EXAMPLE_TEXT.into(),
Expand Down
14 changes: 13 additions & 1 deletion egui_commonmark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! * A list
//! * [ ] Checkbox
//! ";
//! // Stores image handles between each frame
//!
//! # __run_test_ui(|ui| {
//! let mut cache = CommonMarkCache::default();
//! CommonMarkViewer::new("viewer").show(ui, &mut cache, markdown);
Expand All @@ -24,6 +24,18 @@
//! ```toml
//! image = { version = "0.24", default-features = false, features = ["png"] }
//! ```
//!
//! 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:
//!
//! ```
//! # use egui::__run_test_ui;
//! # __run_test_ui(|ui| {
//! ui.style_mut().url_tooltip_on_hover = true;
//! # });
//! ```
//!
//!
//! # Compile time evaluation of markdown
//!
//! If you want to embed markdown directly the binary then you can enable the `macros` feature.
Expand Down

0 comments on commit 0125b07

Please sign in to comment.