Fix handling of @@ link notation (#13637)

The regex was @.*@ which will match anything between two @'s, including a command like:
`k3d cluster create --api-port 6550 -p '9080:80@loadbalancer' -p '9443:443@loadbalancer' --agents 2 --k3s-arg '--disable=traefik@server:*'`

The regex should be something that matches valid URL syntaxes.

Signed-off-by: Daniel Hawton <daniel.hawton@solo.io>
This commit is contained in:
Daniel Hawton 2023-07-26 08:59:41 -06:00 committed by GitHub
parent 2d14e2e08d
commit 2e9e775d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ k3d makes it very easy to create single- and multi-node k3s clusters in docker,
1. Create a cluster and disable `Traefik` with the following command:
{{< text bash >}}
$ k3d cluster create --api-port 6550 -p "9080:80@loadbalancer" -p "9443:443@loadbalancer" --agents 2 --k3s-arg '--disable=traefik@server:*'
$ k3d cluster create --api-port 6550 -p '9080:80@loadbalancer' -p '9443:443@loadbalancer' --agents 2 --k3s-arg '--disable=traefik@server:*'
{{< /text >}}
1. To see the list of k3d clusters, use the following command:

View File

@ -134,7 +134,7 @@
{{- if eq $expand_links "true" -}}
{{- /* include a dummy link to the special embedded @@ references so the links are statically checked as we build the site */ -}}
{{- $branch := .Site.Data.args.source_branch_name -}}
{{- $links := findRE "@(.*?)@" $text -}}
{{- $links := findRE "@([\\w\\.\\-_]*?)@" $text -}}
{{- range $link := $links -}}
{{- $target := trim $link "@" -}}
{{- if gt (len $target) 0 -}}

View File

@ -186,7 +186,7 @@ function handleCodeBlocks() {
if (cmd !== "") {
if (code.dataset.expandlinks === "true") {
cmd = cmd.replace(/@(.*?)@/g, "<a href='https://raw.githubusercontent.com/istio/" + code.dataset.repo + "/" + branchName + "/$1'>$1</a>");
cmd = cmd.replace(/@([\w\.\-_]*?)@/g, "<a href='https://raw.githubusercontent.com/istio/" + code.dataset.repo + "/" + branchName + "/$1'>$1</a>");
}
let html = "<div class='command'>" + cmd + "</div>";