@ -514,6 +514,10 @@ MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
* and then pass updated object to renderer.
**/
MarkdownIt.prototype.parse = function (src, env) {
if (typeof src !== 'string') {
throw new Error('Input data should be a String');
}
var state = new this.core.State(src, this, env);
this.core.process(state);
@ -145,6 +145,15 @@ describe('API', function () {
assert(md.renderInline('_foo_'), '<em>foo</em>');
});
it('input type check', function () {
var md = markdownit();
assert.throws(
function () { md.render(null); },
/Input data should be a String/
);