Do not render truncated links in markdown (#32980) (#32983)

Backport #32980 by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot 2024-12-26 01:12:18 +08:00 committed by GitHub
parent ad1b76540e
commit a0b65ed17f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 40 additions and 17 deletions

View file

@ -3,7 +3,10 @@
package util
import "unsafe"
import (
"strings"
"unsafe"
)
func isSnakeCaseUpper(c byte) bool {
return 'A' <= c && c <= 'Z'
@ -95,3 +98,15 @@ func UnsafeBytesToString(b []byte) string {
func UnsafeStringToBytes(s string) []byte {
return unsafe.Slice(unsafe.StringData(s), len(s))
}
// SplitTrimSpace splits the string at given separator and trims leading and trailing space
func SplitTrimSpace(input, sep string) []string {
input = strings.TrimSpace(input)
var stringList []string
for _, s := range strings.Split(input, sep) {
if s = strings.TrimSpace(s); s != "" {
stringList = append(stringList, s)
}
}
return stringList
}