repo_description: Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one. Gulp and metalsmith plugins available. Used by Facebook, Docusaurus and many others! Use https://github.com/breakdance/breakdance for HTML-to-markdown conversion. Use https://github.com/jonschlinkert/markdown-toc to generate a table of contents.
repo_topics: commonmark compile docusaurus gfm javascript jonschlinkert markdown markdown-it markdown-parser md node nodejs parse parser syntax-highlighting
code: // Horizontal rule
  
  export default function hr(state, startLine, endLine, silent) {
    var marker, cnt, ch,
        pos = state.bMarks[startLine],
        max = state.eMarks[startLine];
  
    pos += state.tShift[startLine];
  
    if (pos > max) { return false; }
  
    marker = state.src.charCodeAt(pos++);
  
    // Check hr marker
    if (marker !== 0x2A/* * */ &&
        marker !== 0x2D/* - */ &&
        marker !== 0x5F/* _ */) {
      return false;
    }
  
    // markers can be mixed with spaces, but there should be at least 3 one
  
    cnt = 1;
    while (pos < max) {
      ch = state.src.charCodeAt(pos++);
      if (ch !== marker && ch !== 0x20/* space */) { return false; }
      if (ch === marker) { cnt++; }
    }
  
    if (cnt < 3) { return false; }
  
    if (silent) { return true; }
  
    state.line = startLine + 1;
    state.tokens.push({
      type: 'hr',
      lines: [ startLine, state.line ],
      level: state.level
    });
  
    return true;
  };
  