Closed
Description
Marked version:
15.0.7
Describe the bug
When providing only subset of hooks it fails on:
Line 297 in 7fee000
hooks
is defined it expects provideLexer
and provideParser
functions to be defined as well)
To Reproduce
import { marked } from "marked";
const options = {
hooks: {
postprocess: (html) => html,
},
};
// Run marked
console.log(marked.parse("# Test", options)); // TypeError: opt.hooks.provideLexer is not a function
Note that when providing options using the use
function, it works:
import { marked } from "marked";
const options = {
hooks: {
postprocess: (html) => html,
},
};
marked.use(options);
console.log(marked("# Test")); // <h1>Test</h1>
Expected behavior
I think it should be possible to provide only subset of hooks when using parse
function as well.