summaryrefslogtreecommitdiffstats
path: root/examples/markdown/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/markdown/src/main.rs')
-rw-r--r--examples/markdown/src/main.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/markdown/src/main.rs b/examples/markdown/src/main.rs
index 173cb389..ade6e453 100644
--- a/examples/markdown/src/main.rs
+++ b/examples/markdown/src/main.rs
@@ -1,3 +1,4 @@
+use iced::highlighter::{self, Highlighter};
use iced::widget::{self, markdown, row, scrollable, text_editor};
use iced::{Element, Fill, Font, Task, Theme};
@@ -63,7 +64,14 @@ impl Markdown {
.on_action(Message::Edit)
.height(Fill)
.padding(10)
- .font(Font::MONOSPACE);
+ .font(Font::MONOSPACE)
+ .highlight::<Highlighter>(
+ highlighter::Settings {
+ theme: highlighter::Theme::Base16Ocean,
+ token: "markdown".to_owned(),
+ },
+ |highlight, _theme| highlight.to_format(),
+ );
let preview = markdown(&self.items, markdown::Settings::default())
.map(Message::LinkClicked);