Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Image API from egui #9

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,27 @@ documentation = "https://docs.rs/egui_commonmark"
include = ["src/*.rs", "LICENSE-MIT", "LICENSE-APACHE", "Cargo.toml"]

[dependencies]
egui = { git = "https://github.com/emilk/egui", rev = "2c7c598" }
image = { version = "0.24", default-features = false, features = ["png"] }
parking_lot = "0.12"
poll-promise = "0.3"
egui = { git = "https://github.com/emilk/egui", rev = "ab48e60" }
pulldown-cmark = { version = "0.9.3", default-features = false }

egui_extras = { git = "https://github.com/emilk/egui", rev = "ab48e60" }

syntect = { version = "5.0.0", optional = true, default-features = false, features = [
"default-fancy",
] }

resvg = { version = "0.35.0", optional = true }
usvg = { version = "0.35.0", optional = true }

url = { version = "2.4", optional = true }
ehttp = { version = "0.3.0", optional = true }

document-features = { version = "0.2", optional = true }

[features]
## Syntax highlighting for code blocks
syntax_highlighting = ["syntect"]

## Support loading svg images
svg = ["resvg", "usvg"]

## Images with urls will be downloaded and displayed
fetch = ["ehttp", "url", "image/jpeg"]

[dev-dependencies]
eframe = { git = "https://github.com/emilk/egui", rev = "2c7c598" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "ab48e60", features = [
"all-loaders",
"log",
] }
eframe = { git = "https://github.com/emilk/egui", rev = "ab48e60" }
image = { version = "0.24", default-features = false, features = ["png"] }

[package.metadata.docs.rs]
# docs.rs build can fail with the fetch feature enabled
Expand Down
4 changes: 3 additions & 1 deletion examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ fn main() {
"Markdown viewer",
eframe::NativeOptions::default(),
Box::new(move |cc| {
// egui_extras::loaders::install(&cc.egui_ctx);
jprochazk marked this conversation as resolved.
Show resolved Hide resolved

cc.egui_ctx.set_visuals(if use_dark_theme {
egui::Visuals::dark()
} else {
egui::Visuals::light()
});

Box::new(App {
cache: CommonMarkCache::default(),
cache: CommonMarkCache::new(&cc.egui_ctx),
})
}),
)
Expand Down
8 changes: 4 additions & 4 deletions examples/link_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ Check out the [previous](#prev) page."#;
}

fn main() {
let mut cache = CommonMarkCache::default();
cache.add_link_hook("#next");
cache.add_link_hook("#prev");
eframe::run_native(
"Markdown link hooks",
eframe::NativeOptions::default(),
Box::new(|_| {
Box::new(|cc| {
let mut cache = CommonMarkCache::new(&cc.egui_ctx);
cache.add_link_hook("#next");
cache.add_link_hook("#prev");
Box::new(App {
cache,
curr_page: 0,
Expand Down
2 changes: 1 addition & 1 deletion examples/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn main() {
});

Box::new(App {
cache: CommonMarkCache::default(),
cache: CommonMarkCache::new(&cc.egui_ctx),
})
}),
)
Expand Down
29 changes: 0 additions & 29 deletions src/fetch_data.rs

This file was deleted.

51 changes: 0 additions & 51 deletions src/image_loading.rs

This file was deleted.

Loading