Skip to content

Commit

Permalink
Reintroduce features
Browse files Browse the repository at this point in the history
This is to reduce breakage and to make egui_commonmark's image loading
work out of the box.
  • Loading branch information
lampsitter committed Sep 13, 2023
1 parent 5ea29ee commit 5dbdc32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ syntect = { version = "5.0.0", optional = true, default-features = false, featur
document-features = { version = "0.2", optional = true }

[features]
default = ["load-images"]
## Syntax highlighting for code blocks
syntax_highlighting = ["syntect"]

load-images = ["egui_extras/image", "egui_extras/file", "image/png"]

## Support loading svg images
svg = ["egui_extras/svg"]

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

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

Expand Down
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@ Github's markdown syntax: tables, strikethrough, tasklists and footnotes.

## Usage

In `Cargo.toml` add the following:

```toml
egui_commonmark = "0.8"

# If you don't need image loading you can ignore the dependencies below.

# Specify the the ways you want to load images, check egui_extras features
# for more info. Or use the feature "all-loaders" if you don't care.
egui_extras = { version = "<to-be-released>", features = ["image", "files"] }

# Opt into the image formats you want to load
image = { version = "0.24", features = ["png"] }
```

```rust
use egui_commonmark::*;
let markdown =
Expand All @@ -42,6 +27,8 @@ CommonMarkViewer::new("viewer").show(ui, &mut cache, markdown);

* `syntax_highlighting`: Syntax highlighting inside code blocks with
[`syntect`](https://crates.io/crates/syntect)
* `svg`: Support for viewing svg images
* `fetch`: Images with urls will be downloaded and displayed

## License

Expand Down

0 comments on commit 5dbdc32

Please sign in to comment.