chore: add warn message for GetRemote usage in shortcodes

This commit is contained in:
ZhenShuo Leo
2025-07-13 19:56:39 +08:00
parent 2c71bda97f
commit d8bdf7e316
6 changed files with 11 additions and 3 deletions

View File

@@ -56,4 +56,6 @@
data-repo-id="{{ $id }}"></script>
</a>
</div>
{{- else -}}
{{ warnf "codeberg shortcode: unable to fetch %q: %s" $codebergURL .Position }}
{{- end -}}

View File

@@ -15,7 +15,7 @@
{{ end }}
{{ if gt $startLine $endLine }}
{{ errorf "Code Importer Shortcode - startLine is greater than endLine" . }}
{{ errorf "codeimporter shortcode: startLine is greater than endLine" . }}
{{ end }}
{{ $selectedLines := first $endLine $lines }}
@@ -23,5 +23,5 @@
{{ $codeBlock := printf "```%s\n%s\n```" $type (delimit $selectedLines "\n") }}
{{ $codeBlock | markdownify }}
{{ else }}
{{ errorf "Code Importer Shortcode - Unable to get remote resource" . }}
{{ warnf "codeimporter shortcode: unable to fetch %q: %s" $url .Position }}
{{ end }}

View File

@@ -56,4 +56,6 @@
data-repo-id="{{ $id }}"></script>
</a>
</div>
{{- else -}}
{{ warnf "forgejo shortcode: unable to fetch %q: %s" $forgejoURL .Position }}
{{- end -}}

View File

@@ -56,4 +56,6 @@
data-repo-id="{{ $id }}"></script>
</a>
</div>
{{- else -}}
{{ warnf "gitea shortcode: unable to fetch %q: %s" $giteaURL .Position }}
{{- end -}}

View File

@@ -71,5 +71,7 @@
data-repo-url="{{ $githubURL }}"
data-repo-id="{{ $id }}"></script>
</a>
{{- else -}}
{{ warnf "github shortcode: unable to fetch %q: %s" $githubURL .Position }}
{{- end -}}
</div>

View File

@@ -2,5 +2,5 @@
{{ with resources.GetRemote (urls.Parse $url) }}
{{ .Content | markdownify }}
{{ else }}
{{ errorf "Mardown Importer Shortcode - Unable to get remote resource" . }}
{{ warnf "mdimporter shortcode: unable to fetch %q: %s" $url .Position }}
{{ end }}