-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v11.0.0. yields "Uncaught Error: renderer 'options' does not exist" in code that worked in versions up to v10.0.0 #3117
Comments
Yes that is because // from https://github.com/markedjs/marked/issues/655#issuecomment-712380889
const markedRenderer = new marked.Renderer();
const linkRenderer = markedRenderer.link;
const renderer = {
link(href, title, text) {
const html = linkRenderer.call(this, href, title, text);
return href.startsWith('/')
? html
: html.replace(
/^<a /,
'<a target="_blank" rel="noreferrer noopener nofollow" '
);
}
};
marked.use({ renderer }); This is something that was only enforced in typescript until v11. Maybe we should ignore the options property instead of throw an error. |
I created a fix (#3118) to skip the properties instead of throwing an error if the class is used. |
Thanks a LOT for the explanation and quick fix. |
Marked version:
11.0.0
Describe the bug
The following code that overrides the
link
renderer with a version that force opening external links in another window, which worked before v11.0.0. now yield a the following error messageUncaught Error: renderer 'options' does not exist
To Reproduce
Steps to reproduce the behavior:
Customize
marked
with the above link rendererExpected behavior
The the custom link renderer works without yielding an error
The text was updated successfully, but these errors were encountered: