Skip to content

Commit e5a5f71

Browse files
committed
Add config option for pulldown-cmark math
1 parent ab0ad33 commit e5a5f71

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

components/config/src/config/markup.rs

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ pub struct Markdown {
4545
pub external_links_no_referrer: bool,
4646
/// Whether smart punctuation is enabled (changing quotes, dashes, dots etc in their typographic form)
4747
pub smart_punctuation: bool,
48+
/// Whether to enable latex math rendering
49+
pub math: bool,
4850
/// Whether footnotes are rendered at the bottom in the style of GitHub.
4951
pub bottom_footnotes: bool,
5052
/// A list of directories to search for additional `.sublime-syntax` and `.tmTheme` files in.
@@ -208,6 +210,7 @@ impl Default for Markdown {
208210
external_links_no_follow: false,
209211
external_links_no_referrer: false,
210212
smart_punctuation: false,
213+
math: false,
211214
bottom_footnotes: false,
212215
extra_syntaxes_and_themes: vec![],
213216
extra_syntax_set: None,

components/markdown/src/markdown.rs

+3
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ pub fn markdown_to_html(
439439
if context.config.markdown.smart_punctuation {
440440
opts.insert(Options::ENABLE_SMART_PUNCTUATION);
441441
}
442+
if context.config.markdown.math {
443+
opts.insert(Options::ENABLE_MATH);
444+
}
442445

443446
// we reverse their order so we can pop them easily in order
444447
let mut html_shortcodes: Vec<_> = html_shortcodes.into_iter().rev().collect();

0 commit comments

Comments
 (0)