notionapi: Index | Files

package tomarkdown

import ""


Package Files


func MarkdownFileNameForPage Uses

func MarkdownFileNameForPage(page *notionapi.Page) string

MarkdownFileNameForPage returns file name for markdown file

func ToMarkdown Uses

func ToMarkdown(page *notionapi.Page) []byte

ToMarkdown converts a page to Markdown

type BlockRenderFunc Uses

type BlockRenderFunc func(block *notionapi.Block) bool

BlockRenderFunc is a function for rendering a particular block

type Converter Uses

type Converter struct {
    Page *notionapi.Page

    // Buf is where HTML is being written to
    Buf *bytes.Buffer

    // allows over-riding rendering of specific blocks
    // return false for default rendering
    RenderBlockOverride BlockRenderFunc

    // RewriteURL allows re-writing URLs e.g. to convert inter-notion URLs
    // to destination URLs
    RewriteURL func(url string) string

    // data provided by they caller, useful when providing
    // RenderBlockOverride
    Data interface{}

    // we need this to properly render ordered and numbered lists
    CurrBlocks   []*notionapi.Block
    CurrBlockIdx int

    Indent string
    ListNo int
    // contains filtered or unexported fields

MarkdownRenderer converts a Page to HTML

func NewConverter Uses

func NewConverter(page *notionapi.Page) *Converter

NewConverter returns customizable Markdown renderer

func (*Converter) AddNewlineBeforeBlock Uses

func (c *Converter) AddNewlineBeforeBlock(block *notionapi.Block)

func (*Converter) DefaultRenderFunc Uses

func (c *Converter) DefaultRenderFunc(blockType string) func(*notionapi.Block)

DefaultRenderFunc returns a defult rendering function for a type of a given block

func (*Converter) Eol Uses

func (c *Converter) Eol()

Eol writes end-of-line to the buffer. Doesn't write multiple.

func (*Converter) FormatDate Uses

func (c *Converter) FormatDate(d *notionapi.Date) string

FormatDate formats the date

func (*Converter) GetInlineContent Uses

func (c *Converter) GetInlineContent(blocks []*notionapi.TextSpan, trimeEndSpace bool) string

GetInlineContent is like RenderInlines but instead of writing to output buffer, we return it as string

func (*Converter) InlineToString Uses

func (c *Converter) InlineToString(b *notionapi.TextSpan) string

InlineToString renders inline block

func (*Converter) IsNextBlockOfType Uses

func (c *Converter) IsNextBlockOfType(t string) bool

IsNextBlockOfType returns true if next block is of a given type

func (*Converter) IsPrevBlockOfType Uses

func (c *Converter) IsPrevBlockOfType(t string) bool

IsPrevBlockOfType returns true if previous block is of a given type

func (*Converter) Newline Uses

func (c *Converter) Newline()

Newline writes a newline to the buffer. It'll suppress multiple newlines.

func (*Converter) NextBlock Uses

func (c *Converter) NextBlock() *notionapi.Block

NextBlock is a block preceding current block

func (*Converter) PopBuffer Uses

func (c *Converter) PopBuffer() *bytes.Buffer

PopBuffer pops a buffer

func (*Converter) PrevBlock Uses

func (c *Converter) PrevBlock() *notionapi.Block

PrevBlock is a block preceding current block

func (*Converter) Printf Uses

func (c *Converter) Printf(format string, args ...interface{})

func (*Converter) PushNewBuffer Uses

func (c *Converter) PushNewBuffer()

PushNewBuffer creates a new buffer and sets Buf to it

func (*Converter) RenderAudio Uses

func (c *Converter) RenderAudio(block *notionapi.Block)

RenderAudio renders BlockAudio

func (*Converter) RenderBlock Uses

func (c *Converter) RenderBlock(block *notionapi.Block)

RenderBlock renders a block to html

func (*Converter) RenderBookmark Uses

func (c *Converter) RenderBookmark(block *notionapi.Block)

RenderBookmark renders BlockBookmark

func (*Converter) RenderBulletedList Uses

func (c *Converter) RenderBulletedList(block *notionapi.Block)

RenderBulletedList renders BlockBulletedList

func (*Converter) RenderCallout Uses

func (c *Converter) RenderCallout(block *notionapi.Block)

RenderCallout renders BlockCallout

func (*Converter) RenderChildren Uses

func (c *Converter) RenderChildren(block *notionapi.Block)

func (*Converter) RenderCode Uses

func (c *Converter) RenderCode(block *notionapi.Block)

RenderCode renders BlockCode

func (*Converter) RenderCollectionView Uses

func (c *Converter) RenderCollectionView(block *notionapi.Block)

RenderCollectionView renders BlockCollectionView

func (*Converter) RenderColumn Uses

func (c *Converter) RenderColumn(block *notionapi.Block)

RenderColumn renders BlockColumn it's parent is BlockColumnList

func (*Converter) RenderColumnList Uses

func (c *Converter) RenderColumnList(block *notionapi.Block)

RenderColumnList renders BlockColumnList it's children are BlockColumn

func (*Converter) RenderDivider Uses

func (c *Converter) RenderDivider(block *notionapi.Block)

RenderDivider renders BlockDivider

func (*Converter) RenderDrive Uses

func (c *Converter) RenderDrive(block *notionapi.Block)

RenderDrive renders BlockDrive

func (*Converter) RenderEmbed Uses

func (c *Converter) RenderEmbed(block *notionapi.Block)

RenderEmbed renders BlockEmbed

func (*Converter) RenderFigma Uses

func (c *Converter) RenderFigma(block *notionapi.Block)

RenderFigma renders BlockFigma

func (*Converter) RenderFile Uses

func (c *Converter) RenderFile(block *notionapi.Block)

RenderFile renders BlockFile

func (*Converter) RenderGist Uses

func (c *Converter) RenderGist(block *notionapi.Block)

RenderGist renders BlockGist

func (*Converter) RenderHeader Uses

func (c *Converter) RenderHeader(block *notionapi.Block)

RenderHeader renders BlockHeader

func (*Converter) RenderHeaderLevel Uses

func (c *Converter) RenderHeaderLevel(block *notionapi.Block, level int)

RenderHeaderLevel renders BlockHeader, SubHeader and SubSubHeader

func (*Converter) RenderImage Uses

func (c *Converter) RenderImage(block *notionapi.Block)

RenderImage renders BlockImage

func (*Converter) RenderInline Uses

func (c *Converter) RenderInline(b *notionapi.TextSpan)

func (*Converter) RenderInlines Uses

func (c *Converter) RenderInlines(blocks []*notionapi.TextSpan, trimEndSpace bool)

RenderInlines renders inline blocks

func (*Converter) RenderNumberedList Uses

func (c *Converter) RenderNumberedList(block *notionapi.Block)

RenderNumberedList renders BlockNumberedList

func (*Converter) RenderPDF Uses

func (c *Converter) RenderPDF(block *notionapi.Block)

RenderPDF renders BlockPDF

func (*Converter) RenderPage Uses

func (c *Converter) RenderPage(block *notionapi.Block)

RenderPage renders BlockPage

func (*Converter) RenderQuote Uses

func (c *Converter) RenderQuote(block *notionapi.Block)

RenderQuote renders BlockQuote

func (*Converter) RenderSubHeader Uses

func (c *Converter) RenderSubHeader(block *notionapi.Block)

RenderSubHeader renders BlockSubHeader

func (*Converter) RenderSubSubHeader Uses

func (c *Converter) RenderSubSubHeader(block *notionapi.Block)

RenderSubSubHeader renders BlocSubSubkHeader

func (*Converter) RenderText Uses

func (c *Converter) RenderText(block *notionapi.Block)

RenderText renders BlockText

func (*Converter) RenderTodo Uses

func (c *Converter) RenderTodo(block *notionapi.Block)

RenderTodo renders BlockTodo

func (*Converter) RenderToggle Uses

func (c *Converter) RenderToggle(block *notionapi.Block)

RenderToggle renders BlockToggle

func (*Converter) RenderTweet Uses

func (c *Converter) RenderTweet(block *notionapi.Block)

RenderTweet renders BlockTweet

func (*Converter) RenderVideo Uses

func (c *Converter) RenderVideo(block *notionapi.Block)

RenderVideo renders BlockTweet

func (*Converter) ToMarkdown Uses

func (c *Converter) ToMarkdown() []byte

func (*Converter) WriteString Uses

func (c *Converter) WriteString(s string)

WriteString writes a string to the buffer

Package tomarkdown imports 4 packages (graph) and is imported by 2 packages. Updated 2019-10-07. Refresh now. Tools for package owners.