Skip to content

Commit

Permalink
Add config option for pulldown-cmark math
Browse files Browse the repository at this point in the history
  • Loading branch information
recmo committed Nov 18, 2024
1 parent d230f5f commit ed5ab04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/config/src/config/markup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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 to enable latex math rendering
pub math: 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.
Expand Down Expand Up @@ -208,6 +210,7 @@ impl Default for Markdown {
external_links_no_follow: false,
external_links_no_referrer: false,
smart_punctuation: false,
math: false,
bottom_footnotes: false,
extra_syntaxes_and_themes: vec![],
extra_syntax_set: None,
Expand Down
3 changes: 3 additions & 0 deletions components/markdown/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ pub fn markdown_to_html(
if context.config.markdown.smart_punctuation {
opts.insert(Options::ENABLE_SMART_PUNCTUATION);
}
if context.config.markdown.math {
opts.insert(Options::ENABLE_MATH);
}

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

0 comments on commit ed5ab04

Please sign in to comment.