Documentation
¶
Overview ¶
Copy from https://github.com/toby3d/telegraph/blob/master/content.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidDataType = errors.New("invalid data type")
Functions ¶
func CreatePage ¶
func CreatePage(data *CreatePageRequest) (string, error)
CreatePage 保存文章,支持判断文章字符是否超出 64 * 1024 byte/字节,超出的话自动截取并且生成多篇文章,且自动将第二篇文章的链接添加到第一篇文章里。
func CreatePageWithClient ¶
func CreatePageWithClient(data CreatePageRequest, client *http.Client) (string, error)
Types ¶
type CreatePageRequest ¶
type CreatePageRequest struct {
AccessToken string `json:"access_token"`
Title string `json:"title" validate:"max=10,min=1"`
Content []Node `json:"content"`
ReturnContent string `json:"return_content"`
Data string `json:-`
AuthorName string `json:"author_name"`
AuthorURL string `json:"author_url"`
}
type Node ¶
type Node interface{}
Node 代表着html数据的Node数据
func ContentFormat ¶
ContentFormat transforms data to a DOM-based format to represent the content of the page.
type NodeElement ¶
type NodeElement struct {
// Name of the DOM element. Available tags: a, aside, b, blockquote, br, code, em, figcaption, figure,
// h3, h4, hr, i, iframe, img, li, ol, p, pre, s, strong, u, ul, video.
Tag string `json:"tag"`
// Attributes of the DOM element. Key of object represents name of attribute, value represents value
// of attribute. Available attributes: href, src.
Attrs map[string]string `json:"attrs,omitempty"`
// List of child nodes for the DOM element.
Children []Node `json:"children,omitempty"`
}
NodeElement 是节点元素
Click to show internal directories.
Click to hide internal directories.