When a delimiter starts with backtick (`), katex renders inside code blocks
josebama opened this issue · 1 comments
josebama commented
When a custom delimiter, either inline or block, starts with backtick (`), the katex syntax is rendered even if it's inside a code block.
For example, given block-delimiter = { left = "```math", right = "```" }
, `$\omega$`
should not be rendered with katex, as the katex syntax is inside inline code, but it does.
This has the potential of affecting many people, as that kind of block delimiter is needed to replicate GitLab Flavoured Markdown syntax.
The issue can be reproduced with the following test:
#[test]
fn test_rendering_delimiter_in_inline_code_when_block_delimiter_starts_with_backtick() {
let raw_content = r"`$\omega$`";
let cfg = KatexConfig {
block_delimiter: Delimiter {
left: "```math".into(),
right: "```".into(),
},
..KatexConfig::default()
};
let (stylesheet_header, mut rendered_content) =
test_render_with_cfg(&[raw_content], HashMap::new(), cfg);
let expected_output = stylesheet_header + raw_content;
debug_assert_eq!(expected_output, rendered_content.pop().unwrap());
}
SichangHe commented