mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
remove extra nl separators
This commit is contained in:
parent
563b228e9e
commit
3358a89735
1 changed files with 7 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ use gtk::{
|
||||||
prelude::{EditableExt, PopoverExt, TextBufferExt, TextTagExt, TextViewExt, WidgetExt},
|
prelude::{EditableExt, PopoverExt, TextBufferExt, TextTagExt, TextViewExt, WidgetExt},
|
||||||
};
|
};
|
||||||
use gutter::Gutter;
|
use gutter::Gutter;
|
||||||
|
use regex::Regex;
|
||||||
use sourceview::prelude::{ActionExt, ActionMapExt, DisplayExt, ToVariant};
|
use sourceview::prelude::{ActionExt, ActionMapExt, DisplayExt, ToVariant};
|
||||||
use std::{cell::Cell, collections::HashMap, rc::Rc};
|
use std::{cell::Cell, collections::HashMap, rc::Rc};
|
||||||
use strip_tags::*;
|
use strip_tags::*;
|
||||||
|
|
@ -52,7 +53,12 @@ impl Markdown {
|
||||||
|
|
||||||
// Init new text buffer
|
// Init new text buffer
|
||||||
let buffer = TextBuffer::new(Some(&TextTagTable::new()));
|
let buffer = TextBuffer::new(Some(&TextTagTable::new()));
|
||||||
buffer.set_text(&strip_tags(markdown)); // @TODO extract `<img>` tags?
|
buffer.set_text(
|
||||||
|
Regex::new(r"\n{3,}")
|
||||||
|
.unwrap()
|
||||||
|
.replace_all(&strip_tags(markdown), "\n")
|
||||||
|
.trim(),
|
||||||
|
); // @TODO extract `<img>` tags?
|
||||||
|
|
||||||
// Init main widget
|
// Init main widget
|
||||||
let text_view = {
|
let text_view = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue