@@ -313,7 +313,9 @@ MarkdownSession* createMarkdownBlockSession() {
313313 plugins.push_back ({std::make_unique<StreamMarkdownUnorderedListPlugin>(false ), MD_UNORDERED_LIST });
314314 plugins.push_back ({std::make_unique<StreamMarkdownHorizontalRulePlugin>(true ), MD_HORIZONTAL_RULE });
315315 plugins.push_back ({std::make_unique<StreamMarkdownBlockLaTeXPlugin>(false ), MD_BLOCK_LATEX });
316- plugins.push_back ({std::make_unique<StreamMarkdownBlockBracketLaTeXPlugin>(false ), MD_BLOCK_LATEX });
316+ // Keep delimiters for \[...\] to avoid swallowing '\' in failed end-matcher branches.
317+ // Delimiters are removed later by extractLatexContent().
318+ plugins.push_back ({std::make_unique<StreamMarkdownBlockBracketLaTeXPlugin>(true ), MD_BLOCK_LATEX });
317319 plugins.push_back ({std::make_unique<StreamMarkdownTablePlugin>(true ), MD_TABLE });
318320 plugins.push_back ({std::make_unique<StreamMarkdownImagePlugin>(true ), MD_IMAGE });
319321 plugins.push_back ({std::make_unique<StreamXmlPlugin>(true ), MD_XML_BLOCK });
@@ -331,7 +333,9 @@ MarkdownSession* createMarkdownInlineSession() {
331333 plugins.push_back ({std::make_unique<StreamMarkdownStrikethroughPlugin>(false ), MD_STRIKETHROUGH });
332334 plugins.push_back ({std::make_unique<StreamMarkdownUnderlinePlugin>(true ), MD_UNDERLINE });
333335 plugins.push_back ({std::make_unique<StreamMarkdownInlineLaTeXPlugin>(false ), MD_INLINE_LATEX });
334- plugins.push_back ({std::make_unique<StreamMarkdownInlineParenLaTeXPlugin>(false ), MD_INLINE_LATEX });
336+ // Keep delimiters for \(...\) to avoid swallowing '\' in failed end-matcher branches.
337+ // Delimiters are removed later by extractLatexContent().
338+ plugins.push_back ({std::make_unique<StreamMarkdownInlineParenLaTeXPlugin>(true ), MD_INLINE_LATEX });
335339 return new MarkdownSession (std::move (plugins));
336340}
337341
0 commit comments