-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add the ability to set a custom URL that is displayed in the error #108
Comments
The results.push({
lineNumber,
"ruleName": rule.names[0],
"ruleNames": rule.names,
"ruleDescription": rule.description,
"ruleInformation": rule.information ? rule.information.href : null,
"errorDetail": errorInfo.detail || null,
"errorContext": errorInfo.context || null,
"errorRange": errorInfo.range ? [ ...errorInfo.range ] : null,
"fixInfo": fixInfo ? cleanFixInfo : null
}); The URL is taken from the rule object and not @DavidAnson This is a valid request as any custom rule may want to provide info URL depending on the error. In order to implement this feature, is it possible to make following change? -- "ruleInformation": rule.information ? rule.information.href : null,
++ "ruleInformation": errorInfo?.information?.href || rule?.information?.href || null, @ACyphus till
c. For now, to support URL for each rule we'll have to cheat a bit by setting Note: b. and c. will break if upstream implementation changes. |
I'm on my phone right now and only had a chance to skim this issue. I'm not sure I understand the issue, though. Each rule is meant to do a single thing and the URL is meant to explain that. If you are implementing multiple rules, you can export them all from the same package and each can have own URL. If it's confusing to point that URL to wherever it is today, you can point it at the markdownlint project if that's more useful? Basically, I'm not clear on why the URL for a particular rule should need to change dynamically. If you're able to clear that up, I would appreciate it. Thanks! |
Actually, I think I understand after looking at your project README. This seems like a bit of an edge case, but it's reasonable for me to add. I put it on my TODO list. |
This scenario will be supported in the next release of |
... and your sneaky trick of changing the rule definition dynamically will not: DavidAnson/markdownlint@14a7529 😀 |
I haven't implemented the trick ;) |
I feel like not mutating should be expected. My second change was just closing an unintentional hole. |
@ACyphus the feature has been published on NPM in the latest version v1.2.0 let me know if it solves your requirement. |
Beautiful! It exactly solves my requirement—thank you @OnkarRuikar and @DavidAnson 💖 👏 |
This is a feature request to be able to define a custom URL for each rule in the config that is used when that rule shows an error.
Currently each error shows the URL of this repository:
https://github.com/OnkarRuikar/markdownlint-rule-search-replace/blob/main/rule.js#L139-L140
For my use case, the error is seen by people in GitHub pull requests that are not familiar with how
markdownlint
works. So when they are reading the error, a link to this repository doesn't help them.Instead, if I was able to add custom URLs to either documentation or the rule definition in my config, they would be able to better understand the rule and how to fix the error.
Thanks for reading and your consideration! This is a helpful tool—I appreciate you working on it 💖
The text was updated successfully, but these errors were encountered: