1pub mod layout;
4pub mod link;
5pub mod picture;
6pub mod preview;
7pub mod typography;
8
9use gpui::App;
10
11pub trait AppExt {
13 fn set_block_renderer(&mut self, renderer: crate::BlockRenderer);
15
16 fn set_find_paint(&mut self, paint: crate::FindPaint);
18
19 fn set_comment_paint(&mut self, paint: crate::CommentPaint);
21
22 fn set_highlighter(
24 &mut self,
25 highlighter: crate::Highlighter,
26 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
27 );
28
29 fn set_markdown_layout(&mut self, layout: crate::Layout);
31
32 #[cfg(feature = "mermaid")]
34 fn set_mermaid_zoom(&mut self, zoom: crate::fence::mermaid::Zoom);
35
36 fn set_links<L: crate::Links>(&mut self);
38
39 fn set_marks(&mut self, marks: crate::Marks);
41
42 fn set_mark_paint(&mut self, paint: crate::paint::marks::Painter);
44
45 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint);
47
48 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static);
50
51 fn set_typography(&mut self, typography: crate::Typography);
53
54 fn highlight_languages(&self) -> &[gpui::SharedString];
56
57 fn markdown_layout(&self) -> crate::Layout;
59
60 fn typography(&self) -> crate::Typography;
62
63 fn marks(&self) -> crate::Marks;
65
66 fn source_style(&self) -> crate::SourceStyle;
68}
69
70impl AppExt for App {
71 fn set_block_renderer(&mut self, renderer: crate::BlockRenderer) {
72 crate::fence::set_block_renderer(self, renderer)
73 }
74
75 fn set_find_paint(&mut self, paint: crate::FindPaint) {
76 crate::paint::find::set_find_paint(self, paint)
77 }
78
79 fn set_comment_paint(&mut self, paint: crate::CommentPaint) {
80 crate::paint::comment::set_comment_paint(self, paint)
81 }
82
83 fn set_highlighter(
84 &mut self,
85 highlighter: crate::Highlighter,
86 languages: impl IntoIterator<Item = impl Into<gpui::SharedString>>,
87 ) {
88 crate::fence::highlight::set_highlighter(self, highlighter, languages)
89 }
90
91 fn set_markdown_layout(&mut self, layout: crate::Layout) {
92 crate::app::layout::set_layout(self, layout)
93 }
94
95 #[cfg(feature = "mermaid")]
96 fn set_mermaid_zoom(&mut self, zoom: crate::fence::mermaid::Zoom) {
97 crate::fence::mermaid::set_zoom(self, zoom)
98 }
99
100 fn set_links<L: crate::Links>(&mut self) {
101 crate::app::link::set_links::<L>(self)
102 }
103
104 fn set_marks(&mut self, marks: crate::Marks) {
105 crate::paint::marks::set_marks(self, marks)
106 }
107
108 fn set_mark_paint(&mut self, paint: crate::paint::marks::Painter) {
109 crate::paint::marks::set_mark_paint(self, paint)
110 }
111
112 fn set_highlight_paint(&mut self, paint: crate::HighlightPaint) {
113 crate::paint::marks::set_highlight_paint(self, paint)
114 }
115
116 fn set_source_style(&mut self, style: impl Fn(&theme::Theme) -> crate::SourceStyle + 'static) {
117 crate::source::style::set_source_style(self, style)
118 }
119
120 fn set_typography(&mut self, typography: crate::Typography) {
121 crate::app::typography::set_typography(self, typography)
122 }
123
124 fn highlight_languages(&self) -> &[gpui::SharedString] {
125 crate::fence::highlight::languages(self)
126 }
127
128 fn markdown_layout(&self) -> crate::Layout {
129 crate::app::layout::Layout::of(self)
130 }
131
132 fn typography(&self) -> crate::Typography {
133 crate::app::typography::Typography::of(self)
134 }
135
136 fn marks(&self) -> crate::Marks {
137 crate::marks::Marks::of(self)
138 }
139
140 fn source_style(&self) -> crate::SourceStyle {
141 crate::source::style::SourceStyle::of(self)
142 }
143}