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

Drop comrak backend #57

Merged
merged 1 commit into from
Jul 17, 2024
Merged
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
3 changes: 0 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
- name: Check all features pulldown
run: cargo check --no-default-features --features pulldown_cmark,better_syntax_highlighting,macros

- name: Check all features comrak
run: cargo check --no-default-features --features comrak,better_syntax_highlighting,macros

- name: Cargo fmt
run: cargo fmt --check -q

Expand Down
34 changes: 0 additions & 34 deletions Backends.md

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Newlines are no longer inserted before/after markdown ([#56](https://github.com/lampsitter/egui_commonmark/pull/56))
> For the old behaviour you can call `ui.label("");` before and and after

## Removed

- Experimental comrak backend ([#57](https://github.com/lampsitter/egui_commonmark/pull/57))

## 0.17.0 - 2024-07-03

### Changed
Expand Down
10 changes: 5 additions & 5 deletions egui_commonmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ egui = { workspace = true }

document-features = { workspace = true, optional = true }

comrak = { version = "0.22.0", default-features = false, optional = true }
pulldown-cmark = { workspace = true, optional = true }
pulldown-cmark = { workspace = true }

[features]
default = ["load-images", "pulldown_cmark"]

## Enable proc macros for compile time generation of egui widgets from markdown
macros = ["dep:egui_commonmark_macros", "dep:pulldown-cmark"] # For simplicity it only supports pulldown-cmark
macros = ["dep:egui_commonmark_macros"] # For simplicity it only supports pulldown-cmark

## Builds upon the `macros` feature. Enables tracking of markdown files to recompile
## when their content changes. Uses nightly features
Expand All @@ -40,8 +39,9 @@ nightly = ["macros", "egui_commonmark_macros/nightly"]
# For internal debugging use only!
dump-macro = ["egui_commonmark_macros/dump-macro"]

pulldown_cmark = ["dep:pulldown-cmark", "egui_commonmark_backend/pulldown-cmark"]
comrak = ["dep:comrak"]
## No-op feature
pulldown_cmark = []

## Syntax highlighting for code blocks using syntect
better_syntax_highlighting = ["egui_commonmark_backend/better_syntax_highlighting"]

Expand Down
7 changes: 1 addition & 6 deletions egui_commonmark/examples/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,12 @@ impl eframe::App for App {
}
}

#[cfg(feature = "comrak")]
const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

eframe::run_native(
&format!("Markdown viewer (backend '{}')", BACKEND),
"Markdown viewer",
eframe::NativeOptions::default(),
Box::new(move |cc| {
if let Some(theme) = args.next() {
Expand Down
7 changes: 1 addition & 6 deletions egui_commonmark/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@ impl eframe::App for App {
}
}

#[cfg(feature = "comrak")]
const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

eframe::run_native(
&format!("Markdown viewer (backend '{}')", BACKEND),
"Markdown viewer",
eframe::NativeOptions::default(),
Box::new(move |cc| {
if let Some(theme) = args.next() {
Expand Down
7 changes: 1 addition & 6 deletions egui_commonmark/examples/link_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ Notice how the destination is not shown on [hover](#prev) unlike with [urls](htt
}
}

#[cfg(feature = "comrak")]
const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

eframe::run_native(
&format!("Markdown viewer link hooks (backend '{}')", BACKEND),
"Markdown viewer link hooks",
eframe::NativeOptions::default(),
Box::new(move |cc| {
if let Some(theme) = args.next() {
Expand Down
7 changes: 1 addition & 6 deletions egui_commonmark/examples/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,12 @@ vec.push(5);
}
}

#[cfg(feature = "comrak")]
const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

eframe::run_native(
&format!("Markdown viewer (backend '{}')", BACKEND),
"Markdown viewer",
eframe::NativeOptions::default(),
Box::new(move |cc| {
if let Some(theme) = args.next() {
Expand Down
7 changes: 1 addition & 6 deletions egui_commonmark/examples/show_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,12 @@ impl eframe::App for App {
}
}

#[cfg(feature = "comrak")]
const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

eframe::run_native(
&format!("Markdown viewer (backend '{}')", BACKEND),
"Markdown viewer",
eframe::NativeOptions::default(),
Box::new(move |cc| {
if let Some(theme) = args.next() {
Expand Down
17 changes: 0 additions & 17 deletions egui_commonmark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ mod parsers;
pub use egui_commonmark_backend::alerts::{Alert, AlertBundle};
pub use egui_commonmark_backend::misc::CommonMarkCache;

#[cfg(all(feature = "comrak", feature = "pulldown_cmark"))]
compile_error!("Cannot have multiple different parsing backends enabled at the same time");

#[cfg(not(any(feature = "comrak", feature = "pulldown_cmark")))]
compile_error!("Either the pulldown_cmark or comrak backend must be enabled");

#[cfg(feature = "macros")]
pub use egui_commonmark_macros::*;

Expand Down Expand Up @@ -177,7 +171,6 @@ impl CommonMarkViewer {
self
}

#[cfg(not(feature = "comrak"))] // not supported by the backend atm.
/// Specify what kind of alerts are supported. This can also be used to localize alerts.
///
/// By default [github flavoured markdown style alerts](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts)
Expand All @@ -196,7 +189,6 @@ impl CommonMarkViewer {
) -> egui::InnerResponse<()> {
egui_commonmark_backend::prepare_show(cache, ui.ctx());

#[cfg(feature = "pulldown_cmark")]
let (response, _) = parsers::pulldown::CommonMarkViewerInternal::new(self.source_id).show(
ui,
cache,
Expand All @@ -205,21 +197,12 @@ impl CommonMarkViewer {
false,
);

#[cfg(feature = "comrak")]
let response = parsers::comrak::CommonMarkViewerInternal::new(self.source_id).show(
ui,
cache,
&self.options,
text,
);

response
}

/// Shows rendered markdown, and allows the rendered ui to mutate the source text.
///
/// The only currently implemented mutation is allowing checkboxes to be toggled through the ui.
#[cfg(feature = "pulldown_cmark")]
pub fn show_mut(
mut self,
ui: &mut egui::Ui,
Expand Down
Loading