start with '~~' means highlight this line
487057
function getLineInfo(bRet,bNum,code) {
    var numCount = 0, hintCount = 0;
    var bLn = code.split(ln_re_), len = bLn.length;
    var iLastLn = -1, sLastNum = '0';
    for (var i=0; i < len; i++) {
      var item = bLn[i], hasHint = false;
      var sNew = item.replace(hint_re_, function(sMatch) {
        hasHint = true; hintCount += 1;
        var iTmp = sMatch.length;
        if (iLastLn + 1 == i) {
          iLastLn = i; sLastNum = (parseInt(sLastNum) + 1) + '';
          iTmp -= 1;
          sLastNum = sLastNum.slice(-iTmp);  // trim to same width: ~~
          if (sLastNum.length < iTmp) sLastNum = (new Array(iTmp-sLastNum.length+1)).join('0') + sLastNum;
          bRet[i] = sLastNum + '!';
        }
        else bRet[i] = (new Array(iTmp)).join(' ') + '!';
        return '';
      });
      
      if (hasHint)
        bLn[i] = sNew;
      else {
        var hasNum = false;
        var sNew2 = item.replace(num_re_, function(sMatch) {
          hasNum = true; numCount += 1;
          sLastNum = bRet[i] = sMatch.slice(0,-1);
          iLastLn = i;
          return '';
        });
        if (hasNum) bLn[i] = sNew2;
      }
    }
    
    if (!bRet.length)   // no changing
      return code;
    else {
      if (!hintCount && numCount <= 1) {  // avoid accident preceed-number
        bRet.splice(0);
        return code;    // no changing
      }
      else {
        if (numCount) bNum.push(numCount);
        return bLn.join('\n');
      }
    }
  }
952470
function (str, highlight) {
      highlight = highlight || false;
      var self = this;

      var highlightColor = this.highlightColor;
      var replace = function (str, pattern) {
        if (!highlight) {
          return str.replace(pattern, function (match) {
            self.currentMatch.matches.push(match);
            return self.replacementString;
          });
        }

        return str.replace(pattern, function (match) {
          self.currentMatch.matches.push(match);
          return '<span style="background: #' + highlightColor + ';">' + match + '</span>';
        });
      }.bind(this);

      if (typeof str !== 'string') {
        throw 'Invalid "str" type supplied in filterString. Expected string.';
      }

      for (var p in this.patterns) {
        if (!this.patterns[p].enabled) {
          continue;
        }

        if (this.patterns[p].pattern instanceof RegExp) {
          str = replace(str, this.patterns[p].pattern);

          continue;
        }

        if (!this.isArray(this.patterns[p].pattern)) {
          throw 'Invalid pattern type supplied. Expected Array.';
        }

        for (var i = 0; i < this.patterns[p].pattern.length; i++) {
          if (!this.patterns[p].pattern[i] instanceof RegExp) {
            throw 'Expected valid RegExp.';
          }

          str = replace(str, this.patterns[p].pattern[i]);
        }
      }

      return str;
    }
482659
def cmd_line(line, ctrl):
    clients = ctrl.modules
    
    if line == "update start":
        for client in clients:
            client.updating_start()
    elif line == "update stop":
        for client in clients:
            client.updating_stop()
    return line
1001058
def line(self, text=''):
        ''''''
        self.out.write(text)
        self.out.write('\n')
726561
def clear_highlight(self, src_id, line_start=0, line_end=-1, async_=None,
                        **kwargs):
        """"""
        async_ = check_async(async_, kwargs, True)
        self.request('nvim_buf_clear_highlight', src_id,
                     line_start, line_end, async_=async_)
884989
@Override
    public void highlight(StringBuilder out, List<String> lines, String meta) {
        out.append("<pre");
        if (StringUtils.isNotBlank(meta)) {
            out.append(" class='brush:" + meta + "'");
        }
        out.append(">");
        for (String line : lines) {
            for (int i = 0; i < line.length(); i++) {
                final char c;
                switch (c = line.charAt(i)) {
                    case '&':
                        out.append("&amp;");
                        break;
                    case '<':
                        out.append("&lt;");
                        break;
                    case '>':
                        out.append("&gt;");
                        break;
                    default:
                        out.append(c);
                        break;
                }
            }
            out.append('\n');
        }
        out.append("</pre>");
    }
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');
    });
  }
1004379
private String mkPreview(int line) {
        StringBuilder sb = new StringBuilder();
        int startLine = line - 3;
        int endLine = line + 3;
        List<String> lines = multiSourceReader.getData();
        for (int i = 0; i < lines.size(); i++) {
            if (i >= startLine && i <= endLine) {
                sb.append(lines.get(i)).append('\n');
            }
        }
        return sb.toString();
    }
845868
def _code_line(self, line):
        """"""
        assert self._containers
        container = self._containers[-1]
        # Handle extra spaces.
        text = line
        while text:
            if text.startswith('  '):
                r = re.match(r'(^ +)', text)
                n = len(r.group(1))
                container.addElement(S(c=n))
                text = text[n:]
            elif '  ' in text:
                assert not text.startswith(' ')
                i = text.index('  ')
                container.addElement(Span(text=text[:i]))
                text = text[i:]
            else:
                container.addElement(Span(text=text))
                text = ''
735210
private void applyHighlighting( String content, int line ) throws BadLocationException {
        int startOffset = rootElement.getElement(line).getStartOffset();
        int endOffset = rootElement.getElement(line).getEndOffset() - 1;
        int lineLength = endOffset - startOffset;
        int contentLength = content.length();
        if (endOffset >= contentLength)
            endOffset = contentLength - 1;
        // check for multi line comments
        // (always set the comment attribute for the entire line)
        if (endingMultiLineComment(content, startOffset, endOffset) || isMultiLineComment()
                || startingMultiLineComment(content, startOffset, endOffset)) {
            doc.setCharacterAttributes(startOffset, endOffset - startOffset + 1, comment, false);
            return;
        }
        // set normal attributes for the line
        doc.setCharacterAttributes(startOffset, lineLength, normal, true);
        // check for single line comment
        int index = content.indexOf(getSingleLineDelimiter(), startOffset);
        if ((index > -1) && (index < endOffset)) {
            doc.setCharacterAttributes(index, endOffset - index + 1, comment, false);
            endOffset = index - 1;
        }
        // check for tokens
        checkForTokens(content, startOffset, endOffset);
    }
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>';
  }
1026361
def highlight_current_line(self):
        """"""
        selection = TextDecoration(self.textCursor())
        selection.format.setProperty(QTextFormat.FullWidthSelection,
                                     to_qvariant(True))
        selection.format.setBackground(self.currentline_color)
        selection.cursor.clearSelection()
        self.set_extra_selections('current_line', [selection])
        self.update_extra_selections()
684458
function lineTop (){
    var l = line(chars.top
               , chars['top-left'] || chars.top
               , chars['top-right'] ||  chars.top
               , chars['top-mid']);
    if (l)
      ret += l + "\n";
  }
201464
def comment_lines(lines, prefix):
    """"""
    if not prefix:
        return lines
    return [prefix + ' ' + line if line else prefix for line in lines]
435069
def _highlight(string, color):
	''''''
	if CONFIG['color']:
		if color < 8:
			return '\033[{color}m{string}\033[0m'.format(string = string, color = color+30)
		else:
			return '\033[{color}m{string}\033[0m'.format(string = string, color = color+82)
	else:
		return string
820649
def get_line_indent(token):
    """"""
    start = token.start_mark.buffer.rfind('\n', 0,
                                          token.start_mark.pointer) + 1
    content = start
    while token.start_mark.buffer[content] == ' ':
        content += 1
    return content - start
546850
private void applyHighlighting( String content, int line ) throws BadLocationException
  {
    int startOffset = _root.getElement( line ).getStartOffset();
    int endOffset = _root.getElement( line ).getEndOffset() - 1;
    int lineLength = endOffset - startOffset;
    int contentLength = content.length();
    if( endOffset >= contentLength )
    {
      endOffset = contentLength - 1;
    }
    // check for multi line comments
    // (always set the comment attribute for the entire line)
    if( endingMultiLineComment( content, startOffset, endOffset ) || isMultiLineComment() || startingMultiLineComment( content, startOffset, endOffset ) )
    {
      setCharacterAttributes( startOffset, endOffset - startOffset + 1, _comment, false );
      return;
    }
    // set normal attributes for the line
    setCharacterAttributes( startOffset, lineLength, _word, true );
    // check for single line comment
    int index = content.indexOf( getSingleLineDelimiter(), startOffset );
    if( (index > -1) && (index < endOffset) )
    {
      setCharacterAttributes( index, endOffset - index + 1, _comment, false );
      endOffset = index - 1;
    }
    // check for tokens
    checkForTokens( content, startOffset, endOffset );
  }