twrite_core/batteries/markdown/config.rs
1/// Configuration settings for Markdown editing, highlighting, and WYSIWYG rendering.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub struct MarkdownConfig {
4 /// How syntax delimiters (`#`, `**`, `*`, `~~`, `` ` ``) are displayed on inactive lines.
5 pub conceal_mode: ConcealMode,
6 /// Whether horizontal rules (`---`, `***`, `___`) are rendered as visual divider quads.
7 pub visual_thematic_breaks: bool,
8 /// Whether clicking on task checkboxes (`- [ ]` / `- [x]`) toggles their state.
9 pub interactive_tasks: bool,
10 /// Whether GFM table pipes, header rows, and delimiter rows get structural styling.
11 pub visual_tables: bool,
12 /// Whether GFM table columns are padded to equal display widths (and
13 /// excluded from soft-wrapping) so pipes form straight columns.
14 pub table_alignment: bool,
15 /// Whether `Tab` / `Shift+Tab` move between table cells and `Enter` continues table rows.
16 pub table_navigation: bool,
17}
18
19impl Default for MarkdownConfig {
20 fn default() -> Self {
21 Self {
22 conceal_mode: ConcealMode::Dimmed,
23 visual_thematic_breaks: true,
24 interactive_tasks: true,
25 visual_tables: true,
26 table_alignment: true,
27 table_navigation: true,
28 }
29 }
30}
31
32/// Display mode for markdown syntax delimiters (like `# `, `**`, `*`, `~~`, `` ` ``) on inactive lines.
33#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
34pub enum ConcealMode {
35 /// Markdown markers are always visible with normal syntax coloring.
36 Off,
37 /// Markdown markers on inactive lines are rendered with faint opacity.
38 #[default]
39 Dimmed,
40 /// Markdown markers on inactive lines are completely hidden (invisible).
41 Hidden,
42}