mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Merge c2db7e9f32 into 04410ff159
This commit is contained in:
commit
2cae83cb9a
5 changed files with 7 additions and 31 deletions
6
.github/workflows/test.yaml
vendored
6
.github/workflows/test.yaml
vendored
|
|
@ -5,16 +5,16 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.21.x, 1.22.x]
|
go-version: [1.22.x, 1.23.x, 1.24.x]
|
||||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ matrix.go-version }}
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Run lints
|
- name: Run lints
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v6
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
run:
|
run:
|
||||||
deadline: 10m
|
timeout: 10m
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
exclude-use-default: false
|
exclude-use-default: false
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -1,3 +1,3 @@
|
||||||
module github.com/yuin/goldmark
|
module github.com/yuin/goldmark
|
||||||
|
|
||||||
go 1.19
|
go 1.21
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func NewDelimiter(canOpen, canClose bool, length int, char byte, processor Delim
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScanDelimiter scans a delimiter by given DelimiterProcessor.
|
// ScanDelimiter scans a delimiter by given DelimiterProcessor.
|
||||||
func ScanDelimiter(line []byte, before rune, min int, processor DelimiterProcessor) *Delimiter {
|
func ScanDelimiter(line []byte, before rune, minimum int, processor DelimiterProcessor) *Delimiter {
|
||||||
i := 0
|
i := 0
|
||||||
c := line[i]
|
c := line[i]
|
||||||
j := i
|
j := i
|
||||||
|
|
@ -120,7 +120,7 @@ func ScanDelimiter(line []byte, before rune, min int, processor DelimiterProcess
|
||||||
}
|
}
|
||||||
for ; j < len(line) && c == line[j]; j++ {
|
for ; j < len(line) && c == line[j]; j++ {
|
||||||
}
|
}
|
||||||
if (j - i) >= min {
|
if (j - i) >= minimum {
|
||||||
after := rune(' ')
|
after := rune(' ')
|
||||||
if j != len(line) {
|
if j != len(line) {
|
||||||
after = util.ToRune(line, j)
|
after = util.ToRune(line, j)
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
//go:build !appengine && !js && !go1.21
|
|
||||||
// +build !appengine,!js,!go1.21
|
|
||||||
|
|
||||||
package util
|
|
||||||
|
|
||||||
import (
|
|
||||||
"reflect"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BytesToReadOnlyString returns a string converted from given bytes.
|
|
||||||
func BytesToReadOnlyString(b []byte) string {
|
|
||||||
return *(*string)(unsafe.Pointer(&b))
|
|
||||||
}
|
|
||||||
|
|
||||||
// StringToReadOnlyBytes returns bytes converted from given string.
|
|
||||||
func StringToReadOnlyBytes(s string) (bs []byte) {
|
|
||||||
sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
|
||||||
bh := (*reflect.SliceHeader)(unsafe.Pointer(&bs))
|
|
||||||
bh.Data = sh.Data
|
|
||||||
bh.Cap = sh.Len
|
|
||||||
bh.Len = sh.Len
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue