Describe the feature
Ability to get the "root" tokens list before rendering - either through a Parser.parse extension, or another mecanism.
Why is this feature necessary?
I need my extension to be able to prepend a default (depth 1) heading token when one is missing.
Describe alternatives you've considered
const defaultParse = Parser.parse;
Parser.parse = (tokens, options) => {
const [{ type, depth }] = tokens;
if (type != "heading" || depth != 1) {
tokens.unshift({
type: 'heading',
depth: 1,
tokens: []
});
}
return defaultParse.call(Parser, tokens, options);
};
but i hate monkey-patching.