Skip to content
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

Clarify deprecation messages for default parameters #2802

Merged

Conversation

calculuschild
Copy link
Contributor

@calculuschild calculuschild commented May 8, 2023

Marked version: 5.0.1

Markdown flavor: n/a

Description

Adds a few clarifying words to the deprecation messages for those parameters that are enabled by default. Users are confused about why they are receiving warnings for parameters they didn't manually set; this help indicate that they are enabled by default and they can also just disable the setting if they don't want to get the extension.

I could see changing "historically" to "currently" (or just removing), if that is more clear wording.

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

@vercel
Copy link

vercel bot commented May 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marked-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 11, 2023 2:44pm

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users are confused about why they are receiving warnings for parameters they didn't manually set

Isn't that a bug? I think we should check if it was assigned before warning.

@UziTech
Copy link
Member

UziTech commented May 9, 2023

We want to alert people who don't set it but still want it that it is deprecated and let them know they should use the extension.

I'm not sure how much time should pass before we change the default to false for those settings but it should probably be soon. This will be a breaking change of course so we will need to release marked v6

@styfle
Copy link
Member

styfle commented May 9, 2023

The message is still confusing to me.

The beginning "should not be used and will be removed in the future" seems contradictory to he second part "can be manually disabled".

I think anyone getting this warning today is going to immediately set {mangle: false, headerIds: false} to silence it, so we are basically increasing usage 😅

Maybe we should create an upgrade guide and have the warning print a link to it.

@calculuschild
Copy link
Contributor Author

calculuschild commented May 9, 2023

The beginning "should not be used and will be removed in the future" seems contradictory to he second part "can be manually disabled".

I'm not sure I understand your point here. Mangle by default is "true". However, is is being deprecated, so users need to manually disable it (or use the separate extension) if they want the deprecation message to go away.

I think anyone getting this warning today is going to immediately set {mangle: false, headerIds: false} to silence it, so we are basically increasing usage 😅

No, setting {mangle: false} would decrease usage of Mangle, which is what we want.

@styfle
Copy link
Member

styfle commented May 9, 2023

(or use the separate extension) if they want the deprecation message to go away.

Does using the extension automatically disable it?

@calculuschild
Copy link
Contributor Author

Ah, probably not. I guess they need to disable the Mangle option either way to get rid of the warning. Then if they still want the mangle functionality, they should get the extension.

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. That's what I thought. So the message is not very clear. Let's update the message to make this clear 👍

src/helpers.js Outdated
@@ -250,7 +250,7 @@ export function checkDeprecations(opt, callback) {
}

if (opt.mangle) {
console.warn('marked(): mangle parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-mangle.');
console.warn('marked(): mangle parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Note the "mangle" parameter is historically enabled by default, but can be manually disabled, or instead use https://www.npmjs.com/package/marked-mangle.');
Copy link
Member

@styfle styfle May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.warn('marked(): mangle parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Note the "mangle" parameter is historically enabled by default, but can be manually disabled, or instead use https://www.npmjs.com/package/marked-mangle.');
console.warn('marked(): mangle parameter is deprecated since version 5.0.0, and will be removed in the future. To enable, install https://npmjs.com/marked-mangle. To disable, set `{mangle: false}`.');

src/helpers.js Outdated
@@ -266,7 +266,7 @@ export function checkDeprecations(opt, callback) {
}

if (opt.headerIds || opt.headerPrefix) {
console.warn('marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-gfm-heading-id.');
console.warn('marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Note the "headerIds" parameter is historically enabled by default, but can be manually disabled, or instead use https://www.npmjs.com/package/marked-gfm-heading-id.');
Copy link
Member

@styfle styfle May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.warn('marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Note the "headerIds" parameter is historically enabled by default, but can be manually disabled, or instead use https://www.npmjs.com/package/marked-gfm-heading-id.');
console.warn('marked(): headerIds and headerPrefix parameters are deprecated since version 5.0.0, and will be removed in the future. To enable, install https://npmjs.com/marked-gfm-heading-id. To disable, set `{headerIds: false}`.');

@UziTech
Copy link
Member

UziTech commented May 9, 2023

@UziTech
Copy link
Member

UziTech commented May 9, 2023

The header id extension doesn't but I will fix that tonight.

@UziTech
Copy link
Member

UziTech commented May 10, 2023

I fixed the header-ids extension. 👍

@calculuschild
Copy link
Contributor Author

calculuschild commented May 10, 2023

Alright. So if the extension already disables the option, is the wording clear as-is, @styfle? Or does that influence your suggested change?

@styfle
Copy link
Member

styfle commented May 11, 2023

@calculuschild I updated my suggestions

@calculuschild
Copy link
Contributor Author

calculuschild commented May 11, 2023

My main goal with this PR was to alert users that these options are enabled by default, to address the confusion of "Users are confused about why they are receiving warnings for parameters they didn't manually set;" So something to that effect needs to remain in the message.

I will take your suggestions, @styfle, and tweak to reintroduce the mention of "enabled by default" so this can still solve the issue it was intended to.

@styfle
Copy link
Member

styfle commented May 11, 2023

We need to make sure the message is actionable.

Alerting for the sake of alerting is going to cause more pain for users.

@calculuschild
Copy link
Contributor Author

calculuschild commented May 11, 2023

Right. Actionable, but also explain why the action is needed, which is the root of the user complaints. We can do both.

Edit: @styfle , I have rewritten the messages to include both the explicit {mangle: false} instruction, as well as the explanation that this parameter is enabled by default.

Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks! 🥇

@UziTech UziTech merged commit 763e9de into markedjs:master May 11, 2023
11 checks passed
github-actions bot pushed a commit that referenced this pull request May 11, 2023
## [5.0.2](v5.0.1...v5.0.2) (2023-05-11)

### Bug Fixes

* Clarify deprecation messages for default parameters ([#2802](#2802)) ([763e9de](763e9de))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI deprecation warning
3 participants