File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ class Markdown {
5858
5959 const updatedOptions = Object . assign ( defaultOptions , options )
6060 this . md = markdownit ( updatedOptions )
61+ this . mathMacro = { }
6162
6263 if ( updatedOptions . sanitize !== 'NONE' ) {
6364 const allowedTags = [ 'iframe' , 'input' , 'b' ,
@@ -117,19 +118,19 @@ class Markdown {
117118 inlineClose : config . preview . latexInlineClose ,
118119 blockOpen : config . preview . latexBlockOpen ,
119120 blockClose : config . preview . latexBlockClose ,
120- inlineRenderer : function ( str ) {
121+ inlineRenderer : ( str ) => {
121122 let output = ''
122123 try {
123- output = katex . renderToString ( str . trim ( ) )
124+ output = katex . renderToString ( str . trim ( ) , { macros : this . mathMacro } )
124125 } catch ( err ) {
125126 output = `<span class="katex-error">${ err . message } </span>`
126127 }
127128 return output
128129 } ,
129- blockRenderer : function ( str ) {
130+ blockRenderer : ( str ) => {
130131 let output = ''
131132 try {
132- output = katex . renderToString ( str . trim ( ) , { displayMode : true } )
133+ output = katex . renderToString ( str . trim ( ) , { displayMode : true , macros : this . mathMacro } )
133134 } catch ( err ) {
134135 output = `<div class="katex-error">${ err . message } </div>`
135136 }
You can’t perform that action at this time.
0 commit comments