mirror of https://github.com/grpc/grpc.io.git
Fix markdown render-link hook so that it doesn't generate unnecessary whitespace (#203)
* Render-link hook cleanup -- no change in generated site * Remove unnecessary whitespace
This commit is contained in:
parent
4479a02c03
commit
672c22e22c
|
|
@ -1,10 +1,15 @@
|
|||
{{ $link := .Destination }}
|
||||
{{ $isRemote := strings.HasPrefix $link "http" }}
|
||||
{{- if not $isRemote -}}
|
||||
{{ $url := urls.Parse .Destination }}
|
||||
{{- if $url.Path -}}
|
||||
{{ $fragment := "" }}
|
||||
{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
|
||||
{{- with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}}
|
||||
{{- end -}}
|
||||
<a href="{{ $link | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank"{{ end }}>{{- .Text | safeHTML -}}</a>
|
||||
{{ $link := .Destination -}}
|
||||
{{ $isRemote := strings.HasPrefix $link "http" -}}
|
||||
{{ if not $isRemote -}}
|
||||
{{ $url := urls.Parse .Destination -}}
|
||||
{{ if $url.Path -}}
|
||||
{{ $fragment := "" -}}
|
||||
{{ with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
|
||||
{{ with .Page.GetPage $url.Path }}{{ $link = printf "%s%s" .RelPermalink $fragment }}{{ end }}{{ end -}}
|
||||
{{ end -}}
|
||||
<a href="{{ $link | safeURL }}"
|
||||
{{- with .Title }} title="{{ . }}"{{ end -}}
|
||||
{{ if $isRemote }} target="_blank"{{ end -}}
|
||||
>
|
||||
{{- .Text | safeHTML -}}
|
||||
</a>
|
||||
Loading…
Reference in New Issue