I have a textearea
called note_text
, a div
called note_preview
and this function:
function fence_math(text) {
return text
.replace(new RegExp('\\\((.*?)\\\)', 'g'), '`memviv-math $1`')
.replace(new RegExp('\\\[(.*?)\\\]', 'g'), '`memviv-equation $1`');
}
If I run this:
note_preview.innerHTML = fence_math(note_text.value);
When note_text
contains
\(a *b* c\)
I get
<div id="note_preview">\`memviv-math a *b* c\`</div>
Why are there backslashes before the accents ? I would have expected:
<div id="note_preview">`memviv-math a *b* c`</div>
What can I do to get the proper result ?