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 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()
Click to show internal directories.
Click to hide internal directories.