diff --git a/lib/index.js b/lib/index.js index 0766e4d..ebf7f2e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -513,6 +513,15 @@ MarkdownIt.prototype.render = function (src, env) { return this.renderer.render(this.parse(src, env), this.options, env); }; + +/** + * MarkdownIt.renderTokens(src [, env]) -> String + * - src (String): source string + * - env (Object): environment sandbox + * + * Render markdown string into an array of html-like tokens. + * If you want to render each token separately (for example with React) + **/ MarkdownIt.prototype.renderTokens = function (src, env) { env = env || {}; diff --git a/lib/renderer.js b/lib/renderer.js index a9ac904..c907860 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -294,6 +294,16 @@ Renderer.prototype.render = function (tokens, options, env) { }, ''); }; + +/** + * Renderer.renderTokens(tokens, options, env) -> String + * - tokens (Array): list on block tokens to renter + * - options (Object): params of parser instance + * - env (Object): additional data from parsed input (references, for example) + * + * Takes token stream and generates html-like tokens. Probably, you will never need to call + * this method directly. + **/ Renderer.prototype.renderTokens = function (tokens, options, env) { var i, len, type, result = '',