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

Add no-generic-link-text rule #10

Merged
merged 17 commits into from
Dec 21, 2022
Prev Previous commit
Next Next commit
Run lint
khiga8 committed Dec 21, 2022
commit cce4a057282b85d4c75f95d5900ac43f7d46707c
4 changes: 3 additions & 1 deletion no-generic-link-text.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,9 @@ module.exports = {
tags: ["accessibility", "links"],
function: function GH002(params, onError) {
// markdown syntax
const allBannedLinkTexts = bannedLinkText.concat(params.config.banned_link_texts || [])
const allBannedLinkTexts = bannedLinkText.concat(
params.config.banned_link_texts || []
);
const inlineTokens = params.tokens.filter((t) => t.type === "inline");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found markdown-it demo and using the debug functionality helpful for understanding how markdown is parsed.

Additionally, I referenced: md042.

for (const token of inlineTokens) {
const { children } = token;