Documentation ¶
Index ¶
- Constants
- Variables
- func CamelCaseToUnderscore(s string) string
- func ConvertRich(t notion.RichText) string
- func ConvertRichText(t []notion.RichText) string
- func ConvertRow(r *notion.TableRowBlock, fmt string) string
- func ConvertTable(rows []notion.Block) string
- func DefaultConfigInit() error
- func FindTextP(ori string, pre string) string
- func FindUrlContext(regex string, url string) string
- func GetBlockType(block any) string
- func HasEmpty(s string) bool
- func RemoveSuffix(str string) (string, error)
- func Run(ns *NotionSite) error
- type Config
- type Files
- type FrontMatter
- type Markdown
- type MdBlock
- type MediaBlock
- type Notion
- type NotionAPI
- type NotionCache
- type NotionCaches
- type NotionProp
- type NotionSite
- type ToMarkdown
- func (tm *ToMarkdown) EnableExtendedSyntax(target string)
- func (tm *ToMarkdown) ExtendedSyntaxEnabled() bool
- func (tm *ToMarkdown) GenBlock(bType string, block MdBlock, addMoreTag bool, skip bool) error
- func (tm *ToMarkdown) GenContentBlocks(blocks []notion.Block, depth int) error
- func (tm *ToMarkdown) GenFrontMatter(writer io.Writer) (*FrontMatter, error)
- func (tm *ToMarkdown) GenerateTo(ns *NotionSite) (*FrontMatter, error)
- func (tm *ToMarkdown) WithFrontMatter(page notion.Page)
Constants ¶
View Source
const ( TagsProp = "Tags" PositionProp = "Position" )
View Source
const Bilibili = "bilibili.com"
View Source
const Gist = "gist.github.com"
View Source
const Jsfiddle = "jsfiddle.net"
View Source
const RegexBili = `((?<=\.com\/video\/).*(?=\/))|((?<=bvid=).*(?=&cid?))`
View Source
const RegexJsfiddle = `(?<=jsfiddle\.net\/).*(?=\/)`
View Source
const RegexTwitterId = `(?<=status\/).*(?=\?)`
View Source
const RegexTwitterUser = `(?<=com\/).*(?=\/status)`
View Source
const RegexYoutube = `(?<=\.com\/watch\?v=).*`
View Source
const Twitter = "twitter.com"
Variables ¶
View Source
var ColorMap = map[string]string{
"gray": grayColor,
"brown": brownColor,
"orange": orangeColor,
"yellow": yellowColor,
"green": greenColor,
"blue": blueColor,
"purple": purpleColor,
"pink": pinkColor,
"red": redColor,
"gray_background": grayBackground,
"brown_background": brownBackground,
"orange_background": orangeBackground,
"yellow_background": yellowBackground,
"green_background": greenBackground,
"blue_background": blueBackground,
"purple_background": purpleBackground,
"pink_background": pinkBackground,
"red_background": redBackground,
}
Functions ¶
func CamelCaseToUnderscore ¶
func ConvertRich ¶
func ConvertRich(t notion.RichText) string
func ConvertRichText ¶
func ConvertRichText(t []notion.RichText) string
func ConvertRow ¶
func ConvertTable ¶
func ConvertTable(rows []notion.Block) string
func DefaultConfigInit ¶
func DefaultConfigInit() error
func FindUrlContext ¶
func GetBlockType ¶
func RemoveSuffix ¶
func Run ¶
func Run(ns *NotionSite) error
Types ¶
type Files ¶
type Files struct { Permission uint32 MediaPath string Position string FileName string FileFolderPath string FilePath string HomePath string DefaultMarkdownName string DefaultMediaFolderName string DefaultGalleryFolderName string CurrentNTPL string // contains filtered or unexported fields }
func (*Files) DownloadMedia ¶
type FrontMatter ¶
type FrontMatter struct { Title string `json:"title" yaml:"title,flow"` Status string `json:"status" yaml:"status,flow"` Author string `json:"author" yaml:"author,flow"` Weight int64 `json:"weight" yaml:"weight,flow"` LastMod string `json:"lastMod" yaml:"lastMod,flow"` CreateAt string `json:"createAt" yaml:"createAt,flow"` ExpiryDate string `json:"expiryDate" yaml:"expiryDate,flow"` Draft bool `json:"draft" yaml:"draft,flow"` IsTranslated bool `json:"isTranslated" yaml:"isTranslated,flow"` ShowComments bool `json:"showComments" yaml:"showComments,flow"` Tags []string `json:"tags" yaml:"tags,flow"` Keywords []string `json:"keywords" yaml:"keywords,flow"` Categories []string `json:"categories" yaml:"categories,flow"` Slug string `json:"slug" yaml:"slug,flow"` Image string `json:"image" yaml:"image,flow"` Avatar string `json:"avatar" yaml:"avatar,flow"` Position string `json:"position" yaml:"position,flow"` AccessPath string `json:"accessPath" yaml:"accessPath,flow"` Description string `json:"description" yaml:"description,flow"` MetaTitle string `json:"metaTitle" yaml:"metaTitle,flow"` MetaDescription string `json:"metaDescription" yaml:"metaDescription,flow"` }
type MediaBlock ¶
type MediaBlock struct { notion.ImageBlock notion.VideoBlock notion.PDFBlock notion.AudioBlock notion.FileBlock }
type NotionAPI ¶
type NotionAPI struct {
Client *notion.Client
}
func (*NotionAPI) CheckHasChildDataBase ¶
func (*NotionAPI) FindBlockChildrenCommentLoop ¶
type NotionCache ¶
type NotionCache struct { ParentPropInfo *NotionProp ParentFilesInfo *Files ChildDatabaseId string }
func NewNotionCaches ¶
func NewNotionCaches() []*NotionCache
type NotionCaches ¶
type NotionCaches struct {
TODO []*NotionCache
}
func (*NotionCaches) SetCache ¶
func (caches *NotionCaches) SetCache(blockId string)
type NotionProp ¶
type NotionProp struct { Name string Title string Status string Categories []string Tags []string Position string FileName string Description string CreateAt *time.Time Author string Avatar string LastMod time.Time ExpiryDate time.Time PublishDate time.Time ShowComments *bool Slug string Types string IsSettingFile bool IsCustomNameFile bool }
func NewNotionProp ¶
func NewNotionProp(page notion.Page) (np *NotionProp)
func (*NotionProp) GetFileName ¶
func (np *NotionProp) GetFileName() string
func (*NotionProp) GetTitle ¶
func (np *NotionProp) GetTitle() (title string)
func (*NotionProp) IsCustomNameMdFile ¶
func (np *NotionProp) IsCustomNameMdFile() bool
IsCustomNameMdFile no setting type but has custom file name
func (*NotionProp) IsFolder ¶
func (np *NotionProp) IsFolder() bool
func (*NotionProp) IsSetting ¶
func (np *NotionProp) IsSetting() bool
type NotionSite ¶
type NotionSite struct {
// contains filtered or unexported fields
}
func NewNotionSite ¶
func NewNotionSite(api *NotionAPI, tm *ToMarkdown, files *Files, config Config, caches []*NotionCache) *NotionSite
func (*NotionSite) SetFileInfo ¶
func (ns *NotionSite) SetFileInfo(position string)
type ToMarkdown ¶
type ToMarkdown struct { NotionProps *NotionProp Files *Files FrontMatter map[string]any ContentBuffer *bytes.Buffer ImgSavePath string ImgVisitPath string ArticleFolderPath string ContentTemplate string // contains filtered or unexported fields }
func New ¶
func New() *ToMarkdown
func (*ToMarkdown) EnableExtendedSyntax ¶
func (tm *ToMarkdown) EnableExtendedSyntax(target string)
func (*ToMarkdown) ExtendedSyntaxEnabled ¶
func (tm *ToMarkdown) ExtendedSyntaxEnabled() bool
func (*ToMarkdown) GenContentBlocks ¶
func (tm *ToMarkdown) GenContentBlocks(blocks []notion.Block, depth int) error
func (*ToMarkdown) GenFrontMatter ¶
func (tm *ToMarkdown) GenFrontMatter(writer io.Writer) (*FrontMatter, error)
func (*ToMarkdown) GenerateTo ¶
func (tm *ToMarkdown) GenerateTo(ns *NotionSite) (*FrontMatter, error)
func (*ToMarkdown) WithFrontMatter ¶
func (tm *ToMarkdown) WithFrontMatter(page notion.Page)
Click to show internal directories.
Click to hide internal directories.