From e75d9e371269a4e46bffa6b3dd1fc7d040e82750 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Tue, 30 Sep 2025 13:34:10 +0200 Subject: add mdedit --- .../github.com/yuin/goldmark/util/util_unsafe_go121.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vendor/github.com/yuin/goldmark/util/util_unsafe_go121.go (limited to 'vendor/github.com/yuin/goldmark/util/util_unsafe_go121.go') diff --git a/vendor/github.com/yuin/goldmark/util/util_unsafe_go121.go b/vendor/github.com/yuin/goldmark/util/util_unsafe_go121.go new file mode 100644 index 0000000..50c7fce --- /dev/null +++ b/vendor/github.com/yuin/goldmark/util/util_unsafe_go121.go @@ -0,0 +1,18 @@ +//go:build !appengine && !js && go1.21 +// +build !appengine,!js,go1.21 + +package util + +import ( + "unsafe" +) + +// BytesToReadOnlyString returns a string converted from given bytes. +func BytesToReadOnlyString(b []byte) string { + return unsafe.String(unsafe.SliceData(b), len(b)) +} + +// StringToReadOnlyBytes returns bytes converted from given string. +func StringToReadOnlyBytes(s string) []byte { + return unsafe.Slice(unsafe.StringData(s), len(s)) +} -- cgit v1.3.1