How to use the marked.parser function in marked

To help you get started, we’ve selected a few marked examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jacobrask / styledocco / styledocco.js View on Github external
.map(function(section) {
      // Run through marked parser to generate HTML.
      return {
        title: section.title ? section.title.trim() : '',
        slug: section.slug || '',
        docs: trimNewLines(marked.parser(section.docs)),
        code: trimNewLines(section.code)
      };
    });
};
github rhiokim / haroopad / src / js / pad / editor / Markdown.FragmentsManager.js View on Github external
function render(token, idx) {
			var tok;

			tok = [ token ];
			tok.links = _links;

			html = marked.parser(tok);
			window.ee.emit('markdown.fragment.change', html, idx);
		}
github tarngerine / excelnotes / renderer.js View on Github external
try {
    let lex = marked.lexer(editor.value);
    lex.forEach((token, i) => {
      if (token.text && token.type !== 'code') {
        token.text = mdmath(token.text);
        lex[i] = token;
      }
      if (token.type === 'table') {
        token.cells = token.cells.map((row) => {
          return row.map((cell) => {
            return mdmath(cell);
          })
        })
      }
    });
    viewer.innerHTML = marked.parser(lex);
  } catch (error) { console.log(error) }
}
github nlf / markitup / lib / parser.js View on Github external
newTokens.push({ type: 'html', pre: 'false', text: '' });
                inDiv = false;
            }
            newTokens.push({ type: 'html', pre: false, text: '<div id="page' + anchorCount + '" class="page">' });
            inDiv = true;
            token.text = '<a id="page' + anchorCount + '"></a>' + token.text;
            anchorCount++; 
        } else if (token.type === 'code') {
            token.text = hljs(token.text, token.lang).value;
            token.escaped = true;
        }
        newTokens.push(token);
    }

    newTokens.links = tokens.links;
    text = marked_.parser(newTokens);
    return text;
}
</div>
github akaJes / marlin-config / app / hints.js View on Github external
swig.setFilter('markdownify', function (input) {
  var tokens = marked.lexer(input);
  return ( marked.parser(tokens) );
})
github strongloop / strong-docs / src / doc.ts View on Github external
depth: token.depth,
          anchor: anchor,
        });

        finalTokens.push({
          type: 'html',
          text: '<a name="' + anchor + '"></a>',
          pre: false,
        });
      }

      finalTokens.push(token);
    }

    finalTokens.links = tokens.links;
    this.html = marked.parser(finalTokens, markedOptions);
  }
github chaijs / chaijs.github.io / routes / plugins.js View on Github external
var tokens = marked.lexer(text)
    , l = tokens.length
    , token;

  for (var i = 0; i &lt; l; i++) {
    token = tokens[i];
    if (token.type == 'code') {
      var lang = token.lang || 'javascript';
      if (lang == 'js') lang = 'javascript';
      if (lang == 'html') lang = 'xml';
      token.text = highlight.highlight(lang, token.text).value;
      token.escaped = true;
    }
  }

  text = marked.parser(tokens);
  return text;
};
github chaijs / chai / docs / app / routes / plugins.js View on Github external
function parseMarkdown (text) {
  var tokens = marked.lexer(text)
    , l = tokens.length
    , token;

  for (var i = 0; i &lt; l; i++) {
    token = tokens[i];
    if (token.type == 'code') {
      var lang = token.lang || 'javascript';
      if (lang == 'js') lang = 'javascript';
      token.text = highlight.highlight(lang, token.text).value;
      token.escaped = true;
    }
  }

  text = marked.parser(tokens);
  return text;
};
github rhiokim / haroopad / src / views / impress / js / app.js View on Github external
var parse = function(src, options) {
  options = options || opt;
  return marked.parser(marked.lexer(src, options), options, renderer);
}
github ember-learn / ember-cli-addon-docs / addon / utils / compile-markdown.js View on Github external
export default function compileMarkdown(source, config) {
  let tokens = marked.lexer(source);
  let markedOptions = {
    highlight: highlightCode,
    renderer: new HBSRenderer(config)
  };

  if (config &amp;&amp; config.targetHandlebars) {
    tokens = compactParagraphs(tokens);
  }

  return `<div class="docs-md">${marked.parser(tokens, markedOptions).trim()}</div>`;
}