Skip to content

Commit

Permalink
Merge pull request #32742 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Apr 30, 2024
2 parents 7719c80 + 0d31da2 commit f22c57c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/content-render/unified/replace-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default function alerts() {
return (tree) => {
visit(tree, matcher, (node) => {
const code = node.children[0].children[0].value
let found = false
for (const [regex, replacement] of VALID_REPLACEMENTS) {
if (regex.test(code)) {
const codeTag = node.children[0]
Expand All @@ -31,13 +30,8 @@ export default function alerts() {
replacements.push(replacement)
codeTag.properties['data-replacedomain'] = replacements
}
found = true
}
}

if (!found && process.env.NODE_ENV === 'development') {
console.warn("The code snippet doesn't contain a valid replacement", { code })
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,12 @@ await fetch("https://HOSTNAME/api/v1")
```js
await fetch("https://HOSTNAME/api/v2")
```

## Not always there

In this next code snippet, the `HOSTNAME` only appears if the current
version is `ghes`. That should be fine.

```text replacedomain copy
ssh handle@{% ifversion ghes %}HOSTNAME{% else %}github.com{% endif %}
```

0 comments on commit f22c57c

Please sign in to comment.