code: function applyInlineFormat(space) {
          var selection, dom, rng, container, offset, startOffset, text, patternRng, pattern, delta, format;
  
          function splitContainer() {
            // Split text node and remove start/end from text node
            container = container.splitText(startOffset);
            container.splitText(offset - startOffset - delta);
            container.deleteData(0, pattern.start.length);
            container.deleteData(container.data.length - pattern.end.length, pattern.end.length);
          }
  
          selection = editor.selection;
          dom = editor.dom;
  
          if (!selection.isCollapsed()) {
            return;
          }
  
          rng = selection.getRng(true);
          container = rng.startContainer;
          offset = rng.startOffset;
          text = container.data;
          delta = space ? 1 : 0;
  
          if (container.nodeType != 3) {
            return;
          }
  
          // Find best matching end
          pattern = findEndPattern(text, offset, delta);
          if (!pattern) {
            return;
          }
  
          // Find start of matched pattern
          // TODO: Might need to improve this if there is nested formats
          startOffset = Math.max(0, offset - delta);
          startOffset = text.lastIndexOf(pattern.start, startOffset - pattern.end.length - 1);
  
          if (startOffset === -1) {
            return;
          }
  
          // Setup a range for the matching word
          patternRng = dom.createRng();
          patternRng.setStart(container, startOffset);
          patternRng.setEnd(container, offset - delta);
          pattern = findPattern(patternRng.toString());
  
          if (!pattern || !pattern.end) {
            return;
          }
  
          // If container match doesn't have anything between start/end then do nothing
          if (container.data.length <= pattern.start.length + pattern.end.length) {
            return;
          }
  
          format = editor.formatter.get(pattern.format);
          if (format && format[0].inline) {
            splitContainer();
            editor.formatter.apply(pattern.format, {}, container);
            return container;
          }
        }
docs: Handles inline formats like *abc* and **abc**