diff --git a/components/config/src/config/markup.rs b/components/config/src/config/markup.rs index 318524b24f..c35021d6bd 100644 --- a/components/config/src/config/markup.rs +++ b/components/config/src/config/markup.rs @@ -47,6 +47,8 @@ pub struct Markdown { pub external_links_no_referrer: bool, /// Whether smart punctuation is enabled (changing quotes, dashes, dots etc in their typographic form) pub smart_punctuation: bool, + /// Whether definition list is enabled + pub definition_list: bool, /// Whether footnotes are rendered at the bottom in the style of GitHub. pub bottom_footnotes: bool, /// A list of directories to search for additional `.sublime-syntax` and `.tmTheme` files in. @@ -227,6 +229,7 @@ impl Default for Markdown { external_links_no_follow: false, external_links_no_referrer: false, smart_punctuation: false, + definition_list: false, bottom_footnotes: false, extra_syntaxes_and_themes: vec![], extra_syntax_set: None, diff --git a/components/markdown/src/markdown.rs b/components/markdown/src/markdown.rs index 04f34475c3..bd69efa93e 100644 --- a/components/markdown/src/markdown.rs +++ b/components/markdown/src/markdown.rs @@ -440,6 +440,9 @@ pub fn markdown_to_html( if context.config.markdown.smart_punctuation { opts.insert(Options::ENABLE_SMART_PUNCTUATION); } + if context.config.markdown.definition_list { + opts.insert(Options::ENABLE_DEFINITION_LIST); + } // we reverse their order so we can pop them easily in order let mut html_shortcodes: Vec<_> = html_shortcodes.into_iter().rev().collect(); diff --git a/components/markdown/tests/markdown.rs b/components/markdown/tests/markdown.rs index 089bcc3aae..6797b8e6f6 100644 --- a/components/markdown/tests/markdown.rs +++ b/components/markdown/tests/markdown.rs @@ -152,6 +152,18 @@ fn can_use_smart_punctuation() { insta::assert_snapshot!(body); } +#[test] +fn can_use_definition_list() { + let mut config = Config::default_for_test(); + config.markdown.definition_list = true; + let content = r#" +term +: definition + "#; + let body = common::render_with_config(content, config).unwrap().body; + insta::assert_snapshot!(body); +} + #[test] fn can_use_external_links_class() { let mut config = Config::default_for_test(); diff --git a/components/markdown/tests/snapshots/markdown__can_use_definition_list.snap b/components/markdown/tests/snapshots/markdown__can_use_definition_list.snap new file mode 100644 index 0000000000..eaa5c1e7e5 --- /dev/null +++ b/components/markdown/tests/snapshots/markdown__can_use_definition_list.snap @@ -0,0 +1,8 @@ +--- +source: components/markdown/tests/markdown.rs +expression: body +--- +