tools

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Package tools provides visitors for external usage and will provide other tools one day.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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. Currently, there is a bug with image galleries that will

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.

Jump to

Keyboard shortcuts

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