src

package
v0.0.0-...-f59483c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger *zap.SugaredLogger
)
View Source
var (
	// ReserveSourceImageUrl 是否保留图片源地址
	ReserveSourceImageUrl bool
)

Functions

func BatchDownloadResource

func BatchDownloadResource(imgElems []*ImageElement) error

func ReRenderContent

func ReRenderContent(content []byte, elems []*ImageElement) []byte

ReRenderContent 渲染最终的markdown文档,主要是替换image标签的url

func UploadImageToHosting

func UploadImageToHosting(elems []*ImageElement)

Types

type DialContext

type DialContext func(ctx context.Context, network, addr string) (net.Conn, error)

type ImageElement

type ImageElement struct {
	// 原数据中的起止索引
	StartIdx, EndIdx int
	// 原数据中的名称和url
	Name string
	URL  *url.URL

	// 图床URL
	HostingURL *url.URL
	// contains filtered or unexported fields
}

ImageElement is markdown图片元素 ![Name](URL)

func FindImageElement

func FindImageElement(content []byte) []*ImageElement

FindImageElement 在文档中解析并查找image标签

func (*ImageElement) AlreadyHosting

func (ie *ImageElement) AlreadyHosting() bool

func (*ImageElement) HoldFile

func (ie *ImageElement) HoldFile(rawData []byte)

func (*ImageElement) HostingFileName

func (ie *ImageElement) HostingFileName() string

HostingFileName 构造图床文件名

func (*ImageElement) IsFinishDownload

func (ie *ImageElement) IsFinishDownload() bool

func (*ImageElement) SetHosting

func (ie *ImageElement) SetHosting()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL