page

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePage

func CreatePage(path string, title string)

func EditPage

func EditPage(path string, markdownPath string, title string)

func GetPage

func GetPage(path string)

func GetViews

func GetViews(path string)

func ListPages

func ListPages()

func MarkdownToHTML

func MarkdownToHTML(markdownText string) (string, error)

Types

type GetPageListRequest

type GetPageListRequest struct {
	AccessToken string `json:"access_token"`
	Offset      int32  `json:"offset"`
	Limit       int32  `json:"limit"`
}

type Node

type Node interface{}

func MarkdownFileToNodes

func MarkdownFileToNodes(path string) ([]Node, error)

func NodesFromHTML

func NodesFromHTML(htmlText string) ([]Node, error)

type NodeElement

type NodeElement struct {
	Tag      string            `json:"tag"`
	Attrs    map[string]string `json:"attrs,omitempty"`
	Children []Node            `json:"children,omitempty"`
}

type Page

type Page struct {
	Path        string `json:"path"`
	URL         string `json:"url"`
	Title       string `json:"title"`
	Description string `json:"description"`
	AuthorName  string `json:"author_name,omitempty"`
	AuthorURL   string `json:"author_url,omitempty"`
	ImageURL    string `json:"image_url,omitempty"`
	Content     []Node `json:"content,omitempty"`
	Views       int    `json:"views"`
	CanEdit     bool   `json:"can_edit,omitempty"`
}

Page represents a page on Telegraph.

type PageList

type PageList struct {
	TotalCount int    `json:"total_count"`
	Pages      []Page `json:"pages"`
}

following types were copied as it is from https://github.com/toby3d/telegraph/blob/master/types.go

type PageViews

type PageViews struct {
	Views int `json:"views"`
}

Jump to

Keyboard shortcuts

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