diff --git a/Cargo.lock b/Cargo.lock index faef56f9..c9572365 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,6 +23,7 @@ dependencies = [ "regex", "rusqlite", "sourceview5", + "strip-tags", "syntect", ] @@ -1369,6 +1370,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "strip-tags" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd2b127e68202f5f285a116f616d5d11735cca5e4befaea0347becd445b05b2" + [[package]] name = "syn" version = "2.0.117" diff --git a/Cargo.toml b/Cargo.toml index cef34946..b6bec1c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ plurify = "0.2.0" r2d2 = "0.8.10" r2d2_sqlite = "0.32.0" regex = "1.12.3" +strip-tags = "0.1.0" syntect = "5.2.0" # development diff --git a/src/app/browser/window/tab/item/page/content/text/markdown.rs b/src/app/browser/window/tab/item/page/content/text/markdown.rs index 49a69990..9eb450d1 100644 --- a/src/app/browser/window/tab/item/page/content/text/markdown.rs +++ b/src/app/browser/window/tab/item/page/content/text/markdown.rs @@ -14,6 +14,7 @@ use gtk::{ use gutter::Gutter; use sourceview::prelude::{ActionExt, ActionMapExt, DisplayExt, ToVariant}; use std::{cell::Cell, collections::HashMap, rc::Rc}; +use strip_tags::*; use tags::Tags; pub struct Markdown { @@ -39,9 +40,6 @@ impl Markdown { // * maybe less expensive than update entire HashMap by iter let hover: Rc>> = Rc::new(Cell::new(None)); - // Init code features - //let mut code = None; - // Init colors // @TODO use accent colors in adw 1.6 / ubuntu 24.10+ let link_color = ( @@ -54,7 +52,7 @@ impl Markdown { // Init new text buffer let buffer = TextBuffer::new(Some(&TextTagTable::new())); - buffer.set_text(markdown); + buffer.set_text(&strip_tags(markdown)); // @TODO extract `` tags? // Init main widget let text_view = {