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

Build: avoid creating broken rule links in the blogpost #7731

Merged
merged 1 commit into from
Dec 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/blogpost.md.ejs
Expand Up @@ -10,13 +10,13 @@ tags:
We just pushed ESLint v<%- version %>, which is a <%- type %> release upgrade of ESLint. This release <% if (type !== "patch") { %>adds some new features and<% } %> fixes several bugs found in the previous release. <% if (type === "major") { %>This release also has some breaking changes, so please read the following closely. <% } %>

<%
const RULE_REGEX = new RegExp(ruleList.map(ruleName => `\`?${ruleName}\`?`).join("|"), "g");
const RULE_REGEX = new RegExp(`\`?(${ruleList.join("|")})\`?`, "g");

function linkify(line) {
return line
.replace(/#(\d+)/g, "[#$1](https://github.com/eslint/eslint/issues/$1)")
.replace(/([a-z0-9]+)/, "[$1](https://github.com/eslint/eslint/commit/$1)")
.replace(RULE_REGEX, "[$&](/docs/rules/$&)");
.replace(RULE_REGEX, "[$&](/docs/rules/$1)");
}

function outputList(items) {
Expand Down