Generates HTML markup for line number column.
@param {String} code     Complete code HTML markup.
@param {Array} lineNumbers Calculated line numbers.
@return {String}       Returns HTML markup.
500514
function(code, lineNumbers)
  {
    var _this = this,
        opts = _this.opts,
        html = '',
        count = _this.lines.length,
        firstLine = parseInt(opts.firstLine || 1),
        pad = opts.padLineNumbers,
        lineNumber,
        i
        ;

    if (pad == true)
      pad = (firstLine + count - 1).toString().length;
    else if (isNaN(pad) == true)
      pad = 0;

    for (i = 0; i < count; i++)
    {
      lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i;
      code = lineNumber == 0 ? opts.space : padNumber(lineNumber, pad);
      html += _this.wrapLine(i, lineNumber, code);
    }

    return html;
  }
203877
public static String format(final String code, final Properties options, final LineEnding lineEnding) {
		Check.notEmpty(code, "code");
		Check.notEmpty(options, "options");
		Check.notNull(lineEnding, "lineEnding");

		final CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
		final String lineSeparator = LineEnding.find(lineEnding, code);
		TextEdit te = null;
		try {
			te = formatter.format(CodeFormatter.K_COMPILATION_UNIT, code, 0, code.length(), 0, lineSeparator);
		} catch (final Exception formatFailed) {
			LOG.warn("Formatting failed", formatFailed);
		}

		String formattedCode = code;
		if (te == null) {
			LOG.info("Code cannot be formatted. Possible cause is unmatched source/target/compliance version.");
		} else {

			final IDocument doc = new Document(code);
			try {
				te.apply(doc);
			} catch (final Exception e) {
				LOG.warn(e.getLocalizedMessage(), e);
			}
			formattedCode = doc.get();
		}
		return formattedCode;
	}
794757
function parseCode2ChartOption(optionCode) {
  const reservedKeys = ['type', 'url'];
  let options = {};
  if (util.isUndefined(optionCode)) {
    return options;
  }

  const optionLines = optionCode.split(REGEX_LINE_ENDING);
  optionLines.forEach(line => {
    let [keyString, ...values] = line.split(OPTION_DELIMITER);
    let value = values.join(OPTION_DELIMITER);
    keyString = keyString.trim();
    if (value.length === 0) {
      return;
    }

    try {
      value = JSON.parse(value.trim());
    } catch (e) {
      value = value.trim();
    }

    // parse keys
    let [...keys] = keyString.split('.');
    let topKey = keys[0];
    if (util.inArray(topKey, reservedKeys) >= 0) {
      // reserved keys for chart plugin option
      keys.unshift('editorChart');
    } else if (keys.length === 1) {
      // short names for `chart`
      keys.unshift('chart');
    } else if (topKey === 'x' || topKey === 'y') {
      // short-handed keys
      keys[0] = `${topKey}Axis`;
    }

    let option = options;
    for (let i = 0; i < keys.length; i += 1) {
      let key = keys[i];
      option[key] = option[key] || (keys.length - 1 === i ? value : {});
      option = option[key];
    }
  });

  return options;
}
630081
function ( code ) {
		var text = code.firstChild;
		if ( text ) {
			text.data = text.data.substring ( 1 ); // we inserted a #
		}
	}
545653
function parse(code) {
  var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

  opts.allowHashBang = true;
  opts.sourceType = "module";
  opts.ecmaVersion = Infinity;
  opts.plugins = {
    jsx: true,
    flow: true
  };
  opts.features = {};

  for (var key in _transformation2["default"].pipeline.transformers) {
    opts.features[key] = true;
  }

  var ast = babylon.parse(code, opts);

  if (opts.onToken) {
    // istanbul ignore next

    var _opts$onToken;

    (_opts$onToken = opts.onToken).push.apply(_opts$onToken, ast.tokens);
  }

  if (opts.onComment) {
    // istanbul ignore next

    var _opts$onComment;

    (_opts$onComment = opts.onComment).push.apply(_opts$onComment, ast.comments);
  }

  return ast.program;
}
156378
function getCodeFrame(source: string, line: number, column: number) {
  const loc = {
    start: { line, column }
  };

  return "\n" + codeFrameFromSource(source, loc) + "\n";
}
330203
function (markup) {
		var vmlStyle = 'display:inline-block;behavior:url(#default#VML);',
			isIE8 = this.isIE8;

		markup = markup.join('');

		if (isIE8) { // add xmlns and style inline
			markup = markup.replace('/>', ' xmlns="urn:schemas-microsoft-com:vml" />');
			if (markup.indexOf('style="') === -1) {
				markup = markup.replace('/>', ' style="' + vmlStyle + '" />');
			} else {
				markup = markup.replace('style="', 'style="' + vmlStyle);
			}

		} else { // add namespace
			markup = markup.replace('<', '<hcv:');
		}

		return markup;
	}
1141692
function (code, language, bare) {
    var result;
    if (typeof hljs !== 'undefined') {
      if (language) {
        try {
          result = hljs.highlight(language, code, true);
        }
        catch (e) {
          Ember.warn(
            '[marked] Failing to highlight some code with language `' + language +
            '`, trying auto-detecting language (error: ' + e + ').'
          );
          result = hljs.highlightAuto(code);
        }
      }
      else {
        result = hljs.highlightAuto(code);
      }
      result.value = '<pre><code>' + result.value + '</code></pre>';
      if (bare) {
        return result;
      }
      else {
        return result.value;
      }
    }
    else {
      result = '<pre><code>' + (code || '').replace(/<>&/g, entitiesReplacer) + '</code></pre>';
      if (bare) {
        return {value: result, language: null};
      }
      else {
        return result;
      }
    }
  }
933311
def run(self, lines):
        
        text = "\n".join(lines)
        while 1:
            m = FENCED_BLOCK_RE.search(text)
            if not m:
                break
            lang = m.group('lang')
            linenums = bool(m.group('linenums'))
            html = highlight_syntax(m.group('code'), lang, linenums=linenums)
            placeholder = self.markdown.htmlStash.store(html, safe=True)
            text = '{}\n{}\n{}'.format(
                text[:m.start()],
                placeholder,
                text[m.end():]
            )

        return text.split("\n")
845165
function diff (code, lang) {
  var sections = []

  code.split(/\r?\n/g).forEach(function (line) {
    var type

    if (CHUNK_REGEXP.test(line)) {
      type = 'chunk'
    } else if (HEADER_REGEXP.test(line)) {
      type = 'header'
    } else {
      type = PATCH_TYPES[line[0]] || 'null'
      line = line.replace(/^[+\-! ]/, '')
    }

    // Merge data with the previous section where possible.
    var previous = sections[sections.length - 1]

    if (!previous || previous.type !== type) {
      sections.push({
        type: type,
        lines: [line]
      })

      return
    }

    previous.lines.push(line)
  })

  return highlightSections(sections, lang)
    .map(function (section) {
      var type = section.type
      var value = section.lines.join(SEPARATOR)

      return '<span class="diff-' + type + '">' + value + '</span>'
    })
    .join(SEPARATOR)
}
1180942
function lineNumberOfCharacterIndex(code, idx) {
  var everythingUpUntilTheIndex = code.substring(0, idx);
  // computer science!
  return everythingUpUntilTheIndex.split("\n").length;
}
859548
function convertCode2Script(code) {
    // clean source code comment
    return code
        .replace(/\/\/\/ <reference path="[\s\S]*?>/gm, '')
        .replace(/\r\n/gm, '\n')
        .replace(convert.mapFileCommentRegex, '')
        .trim('\n') + '\n';
}
569404
function(/**Number*/ lineIndex) {
			var mode = this.mode, lines = this.lines;
			var i, line;
			for (i = lineIndex-1; i >= 0; i--) {
				line = lines[i];
				if (line.eolState || lineIndex - i > MAX_BACKTRACK) {
					// CodeMirror optimizes by using least-indented line; we just use this line
					break;
				}
			}
			var state = (i >= 0) && lines[i].eolState;
			if (state) {
				state = this.codeMirror.copyState(mode, state);
				// Highlight from i up to lineIndex-1
				i = Math.max(0, i);
				for (var j = i; j < lineIndex-1; j++) {
					line = lines[j];
					this.highlightLine(j, line, state);
					line.eolState = this.codeMirror.copyState(mode, state);
				}
				return state; // is a copy of lines[lineIndex - 1].eolState
			} else {
				return mode.startState();
			}
		}
1252306
function (element, number) {
			if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
				return;
			}

			var lineNumberRows = element.querySelector('.line-numbers-rows');
			var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
			var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);

			if (number < lineNumberStart) {
				number = lineNumberStart;
			}
			if (number > lineNumberEnd) {
				number = lineNumberEnd;
			}

			var lineIndex = number - lineNumberStart;

			return lineNumberRows.children[lineIndex];
		}
555417
function highlight() {
    $('pre code').each(function (i, block) {
      hljs.highlightBlock(block);
    });
    $('pre code[highlight-lines]').each(function (i, block) {
      if (block.innerHTML === "") return;
      var lines = block.innerHTML.split('\n');

      queryString = block.getAttribute('highlight-lines');
      if (!queryString) return;

      var ranges = queryString.split(',');
      for (var j = 0, range; range = ranges[j++];) {
        var found = range.match(/^(\d+)\-(\d+)?$/);
        if (found) {
          // consider region as `{startlinenumber}-{endlinenumber}`, in which {endlinenumber} is optional
          var start = +found[1];
          var end = +found[2];
          if (isNaN(end) || end > lines.length) {
            end = lines.length;
          }
        } else {
          // consider region as a sigine line number
          if (isNaN(range)) continue;
          var start = +range;
          var end = start;
        }
        if (start <= 0 || end <= 0 || start > end || start > lines.length) {
          // skip current region if invalid
          continue;
        }
        lines[start - 1] = '<span class="line-highlight">' + lines[start - 1];
        lines[end - 1] = lines[end - 1] + '</span>';
      }

      block.innerHTML = lines.join('\n');
    });
  }
350361
function(lineIndex, lineNumber, lineHtml)
  {
    var classes = [
      'line',
      'number' + lineNumber,
      'index' + lineIndex,
      'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString()
    ];

    if (this.linesToHighlight[lineNumber])
      classes.push('highlighted');

    if (lineNumber == 0)
      classes.push('break');

    return '<div class="' + classes.join(' ') + '">' + lineHtml + '</div>';
  }
169750
function(code) {
    var lines = [];
    code.split(/\n/).forEach(line => {
      var segs = line.split(/(\s*#)/);
      var ln = {code: segs[0]};
      if (segs.length > 1)
        ln.comment = segs.reduce((c, seg, i) => i > 1 ? c + seg : seg, '');
      lines.push(ln);
    });
    return lines;
  }