Conversation
|
👋 Hello and thanks for pinging us! An accessibility first responder will review this soon.
|
|
I am finally revisiting this as downtime work during FR and following the steps outlined in: https://github.com/github/markdownlint-github#development to try running this rule. However, I'm finding that the custom rules aren't running at all. I thought that this was a problem with my branch, but I'm seeing that the published package might be broken too. In the accessibility repo, I introduced a violation but that isn't being flagged... Update: It seemed to be an issue with the config in accessibility repo! Proceeding! |
- We don't want anything to break when link is blank. - Tests should account for links with punctuation text.
|
I made some updates because when I tested this against the I made additional updates by peeking at a link text related rules in I additionally pulled the I also added support so consumers can configure additional banned texts like so in addition to the default ones we have: I opened a separate issue to add docs for each rule: #12. I am hoping to cut a new release after this! |
| function: function GH002(params, onError) { | ||
| // markdown syntax | ||
| const allBannedLinkTexts = bannedLinkText.concat( | ||
| params.config.additional_banned_texts || [] |
There was a problem hiding this comment.
I'm using snake case to follow the convention set in markdownlint for how rule configs are set.
| const allBannedLinkTexts = bannedLinkText.concat( | ||
| params.config.additional_banned_texts || [] | ||
| ); | ||
| const inlineTokens = params.tokens.filter((t) => t.type === "inline"); |
There was a problem hiding this comment.
I found markdown-it demo and using the debug functionality helpful for understanding how markdown is parsed.
Additionally, I referenced: md042.
|
I want to see this rule running in our projects successfully. Then I plan to upstream it to |
| expect(results[0].errorDetail).toBe("For link: Click here"); | ||
| }); | ||
|
|
||
| test("additional words can be configured", async () => { |
| @@ -0,0 +1,50 @@ | |||
| const { stripAndDowncaseText } = require("./helpers/strip-and-downcase-text"); | |||
|
|
|||
| const bannedLinkText = [ | |||
There was a problem hiding this comment.
Would it be possible or worth making this work for various languages?
There was a problem hiding this comment.
This plugin doesn't currently have i18n support, but I added support so people can additionally configure text so they can through that!
Related: #10 (comment)
There was a problem hiding this comment.
I think we will want to address i18n in a separate issue! I'll make an issue.
Giving markdownlint rule-making a go 💪
no-generic-link-text. This follows a similar rule we have in erblint-github. Seems like this would be a common violation in markdown.For now this rule only handles inline links because I wanted to avoid the complexities around determining link text of a link tag, especially since different markdown parsers have different levels of ARIA support.