goessner/markdown-it-texmath

Option to support multiple delimiters

tlylt opened this issue · 2 comments

tlylt commented

Hi,
I am using markdown-it-texmath in a project(Thank you!) with 'bracket' as the delimiter. Would like to ask if it is currently possible for users to specify more than one of the supported delimiters to use interchangeably.
E.g. possible to do something like delimiters: ['dollars', 'brackets'] ?

const tm = require('markdown-it-texmath');
const md = require('markdown-it')({html:true})
                  .use(tm, { engine: require('katex'),
                             delimiters: 'dollars', 
                             katexOptions: { macros: {"\\RR": "\\mathbb{R}"} } });

Thanks!

tlylt commented

Found a convenient but somewhat hacky solution of requiring the plugin twice.

markdownIt.use(require('markdown-it-mark'))
	//...
  .use(require('markdown-it-texmath'), { engine: katex, delimiters: 'brackets' })
  .use(require('markdown-it-texmath'))

Support of simultaneous use of multiple delimiters now with Version 1.0 . Thanks for proposing.