Documentation ¶
Overview ¶
Package tools provides visitors for external usage and will provide other tools one day.
Index ¶
- func HeadingVisitor(ctx mycocontext.Context) (visitor func(block blocks.Block), result func() []blocks.Heading)
- func LinkVisitor(ctx mycocontext.Context) (visitor func(block blocks.Block), result func() []links.Link)
- func MigrateHeadings(old string) string
- func MigrateRocketLinks(old string) string
- func OpenGraphVisitors(ctx mycocontext.Context) (resultHTML func() string, descVisitor func(blocks.Block), ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeadingVisitor ¶
func HeadingVisitor(ctx mycocontext.Context) ( visitor func(block blocks.Block), result func() []blocks.Heading, )
HeadingVisitor creates a visitor that visits all headings.
func LinkVisitor ¶
func LinkVisitor(ctx mycocontext.Context) ( visitor func(block blocks.Block), result func() []links.Link, )
LinkVisitor creates a visitor which extracts all the links from the document in context.
We consider inline link, rocket link, image gallery and transclusion targets to be links.
func MigrateHeadings ¶
MigrateHeadings replaces all instances of the old heading syntax with the new one it can find in the given document and returns the modified version.
func MigrateRocketLinks ¶
MigrateRocketLinks replaces all instances of the old rocket link syntax with the new one it can find in the given document and returns the modified version.
func OpenGraphVisitors ¶
func OpenGraphVisitors(ctx mycocontext.Context) ( resultHTML func() string, descVisitor func(blocks.Block), imgVisitor func(blocks.Block), )
OpenGraphVisitors returns visitors you should pass to BlockTree. They will figure out what should go to the final opengraph. Call resultHTML to get that result.
description is the first root paragraph of the document. If there is no such paragraph, the description is empty string.
Types ¶
This section is empty.