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 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) error
- func (tm *ToMarkdown) GenerateTo(ns *NotionSite) 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 ¶ added in v1.0.6
func ConvertRich ¶ added in v1.1.0
func ConvertRich(t notion.RichText) string
func ConvertRichText ¶ added in v1.1.0
func ConvertRichText(t []notion.RichText) string
func ConvertRow ¶ added in v1.1.0
func ConvertTable ¶ added in v1.1.0
func ConvertTable(rows []notion.Block) string
func DefaultConfigInit ¶ added in v1.1.0
func DefaultConfigInit() error
func FindUrlContext ¶ added in v1.0.6
func GetBlockType ¶ added in v1.0.6
func Run ¶ added in v1.1.0
func Run(ns *NotionSite) error
Types ¶
type Files ¶ added in v1.1.0
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 ¶ added in v1.1.0
type FrontMatter ¶ added in v1.1.0
type FrontMatter struct { Title interface{} `yaml:",flow"` Status interface{} `yaml:",flow"` Position interface{} `yaml:",flow"` Categories []interface{} `yaml:",flow"` Tags []interface{} `yaml:",flow"` Keywords []interface{} `yaml:",flow"` CreateAt interface{} `yaml:",flow"` Author interface{} `yaml:",flow"` IsTranslated interface{} `yaml:",flow"` Lastmod interface{} `yaml:",flow"` Description interface{} `yaml:",flow"` Draft interface{} `yaml:",flow"` ExpiryDate interface{} `yaml:",flow"` //PublishDate interface{} `yaml:",flow"` Show_comments interface{} `yaml:",flow"` //Calculate Chinese word count accurately. Default is true //IsCJKLanguage interface{} `yaml:",flow"` Slug interface{} `yaml:",flow"` Image interface{} `yaml:",flow"` Weight interface{} `yaml:",flow"` }
type MediaBlock ¶ added in v1.1.0
type MediaBlock struct { notion.ImageBlock notion.VideoBlock notion.PDFBlock notion.AudioBlock notion.FileBlock }
type NotionAPI ¶ added in v1.1.0
type NotionAPI struct {
Client *notion.Client
}
func (*NotionAPI) CheckHasChildDataBase ¶ added in v1.1.0
func (*NotionAPI) FindBlockChildrenCommentLoop ¶ added in v1.1.0
type NotionCache ¶ added in v1.1.0
type NotionCache struct { ParentPropInfo *NotionProp ParentFilesInfo *Files ChildDatabaseId string }
func NewNotionCaches ¶ added in v1.1.0
func NewNotionCaches() []*NotionCache
type NotionCaches ¶ added in v1.1.0
type NotionCaches struct {
TODO []*NotionCache
}
func (*NotionCaches) SetCache ¶ added in v1.1.0
func (caches *NotionCaches) SetCache(blockId string)
type NotionProp ¶ added in v1.1.0
type NotionProp struct { Name string Title string Status string Categories []string Tags []string Position string FileName string Description string CreateAt *time.Time Author string LastMod time.Time ExpiryDate time.Time PublishDate time.Time ShowComments *bool Slug string Types string IsSettingFile bool IsCustomNameFile bool }
func NewNotionProp ¶ added in v1.1.0
func NewNotionProp(page notion.Page) (np *NotionProp)
func (*NotionProp) GetFileName ¶ added in v1.1.0
func (np *NotionProp) GetFileName() string
func (*NotionProp) GetTitle ¶ added in v1.1.0
func (np *NotionProp) GetTitle() (title string)
func (*NotionProp) IsCustomNameMdFile ¶ added in v1.1.0
func (np *NotionProp) IsCustomNameMdFile() bool
IsCustomNameMdFile no setting type but has custom file name
func (*NotionProp) IsFolder ¶ added in v1.1.0
func (np *NotionProp) IsFolder() bool
func (*NotionProp) IsSetting ¶ added in v1.1.0
func (np *NotionProp) IsSetting() bool
type NotionSite ¶ added in v1.1.0
type NotionSite struct {
// contains filtered or unexported fields
}
func NewNotionSite ¶ added in v1.1.0
func NewNotionSite(api *NotionAPI, tm *ToMarkdown, files *Files, config Config, caches []*NotionCache) *NotionSite
func (*NotionSite) SetFileInfo ¶ added in v1.1.0
func (ns *NotionSite) SetFileInfo(position string)
type ToMarkdown ¶ added in v1.1.0
type ToMarkdown struct { NotionProps *NotionProp Files *Files FrontMatter map[string]interface{} ContentBuffer *bytes.Buffer ImgSavePath string ImgVisitPath string ArticleFolderPath string ContentTemplate string // contains filtered or unexported fields }
func New ¶ added in v1.1.0
func New() *ToMarkdown
func (*ToMarkdown) EnableExtendedSyntax ¶ added in v1.1.0
func (tm *ToMarkdown) EnableExtendedSyntax(target string)
func (*ToMarkdown) ExtendedSyntaxEnabled ¶ added in v1.1.0
func (tm *ToMarkdown) ExtendedSyntaxEnabled() bool
func (*ToMarkdown) GenContentBlocks ¶ added in v1.1.0
func (tm *ToMarkdown) GenContentBlocks(blocks []notion.Block, depth int) error
func (*ToMarkdown) GenFrontMatter ¶ added in v1.1.0
func (tm *ToMarkdown) GenFrontMatter(writer io.Writer) error
func (*ToMarkdown) GenerateTo ¶ added in v1.1.0
func (tm *ToMarkdown) GenerateTo(ns *NotionSite) error
func (*ToMarkdown) WithFrontMatter ¶ added in v1.1.0
func (tm *ToMarkdown) WithFrontMatter(page notion.Page)
Click to show internal directories.
Click to hide internal directories.