code: function parseInlineKatex(state, silent) {
          var dollar = 0x24;
          var pos = state.pos;
          var start = pos, max = state.posMax, marker, matchStart, matchEnd ;
  
          if (state.src.charCodeAt(pos) !== dollar) { return false; }
          ++pos;
  
          while (pos < max && state.src.charCodeAt(pos) === dollar) {
              ++pos;
          }
  
          marker = state.src.slice(start, pos);
          if (marker.length > 2) { return false; }
  
          matchStart = matchEnd = pos;
          
          while ((matchStart = state.src.indexOf('$', matchEnd)) !== -1) {
              matchEnd = matchStart + 1;
              
              while (matchEnd < max && state.src.charCodeAt(matchEnd) === dollar) {
                  ++matchEnd;
              }
              
              if (matchEnd - matchStart == marker.length) {
                  if (!silent) {
                      var content = state.src.slice(pos, matchStart)
                                             .replace(/[ \n]+/g, ' ')
                                             .trim();
  
                      state.push({
                          type: 'katex',
                          content: content,
                          block: marker.length > 1,
                          level: state.level
                      });
                  }
  
                  state.pos = matchEnd;
                  return true;
              }
          }
  
          if (! silent) state.pending += marker;
          state.pos += marker.length;
  
          return true;
      }
docs: Look for '$' or '$$' spans in Markdown text. Based off of the 'fenced' parser in remarkable.