/**
 * Copied from remark:parse:tokenize:code-inline
 * Modified to use an exclamation mark as starter
 * for inline math
 *
 * original @author Titus Wormer
 * @copyright 2015 Titus Wormer
 * @license MIT
 */

const locator = (value, fromIndex) => value.indexOf('`', fromIndex);

const tokenizer = (eat, value, silent) => {
  if (!value.startsWith('`!')) {
    return undefined;
  }

  if (value.length < 3 || value.charAt(2) === '`') {
    return undefined;
  }

  if (silent) {
    return true;
  }

  let index = 2;
  const length = value.length;
  while (index < length && value.charAt(index) !== '`') {
    index += 1;
  }

  const full = value.substring(0, index + 1);
  const eq = value.substring(2, index);

  return eat(full)({
    type: 'inlineCode',
    value: eq,
    data: {
      hProperties: { className: 'language-inlineEquation' },
    },
  });
};

tokenizer.locator = locator;
tokenizer.notInLink = true;

const plugin = (processor) => {
  const Parser = processor.Parser;
  const tokenizers = Parser.prototype.inlineTokenizers;
  const methods = Parser.prototype.inlineMethods;

  tokenizers.math = tokenizer;
  methods.splice(methods.indexOf('code'), 0, 'math');
};

export default plugin;

@@ -204,16 +204,68 @@
 IT%0A */%0A%0A
+const startingBlock = '$';%0Aconst endingChar = '$';%0A%0A
 const lo
@@ -308,19 +308,29 @@
 indexOf(
-'%60'
+startingBlock
 , fromIn
@@ -408,12 +408,21 @@
 ith(
-'%60!'
+startingBlock
 )) %7B
@@ -472,38 +472,52 @@
 gth 
-%3C 3 %7C%7C value.charAt(2) === '%60'
+=== startingBlock.length + endingChar.length
 ) %7B%0A
@@ -595,17 +595,36 @@
 index = 
-2
+startingBlock.length
 ;%0A  cons
@@ -703,11 +703,18 @@
 !== 
-'%60'
+endingChar
 ) %7B%0A
@@ -809,17 +809,36 @@
 bstring(
-2
+startingBlock.length
 , index)

Change inline math regex