pipeline

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LinkRegex is the regex of links in posts
	LinkRegex = regexp.MustCompile(`(^|\s)(\[\[(\w|-)+\]\])(\s|$)`)
)

Functions

func ConvertMarkdownToHTML

func ConvertMarkdownToHTML(posts []Post, syntaxStyle string) error

ConvertMarkdownToHTML converts post's body into HTML

func MakeGraph

func MakeGraph(posts []Post) (*graph.Mutable, error)

MakeGraph returns a graph for a given list of `Posts`.

func ReplaceLinks(posts []Post, sitePrefix string, stripHTML bool) error

ReplaceLinks replaces all the `[[]]` links in the body with the link to the HTML page.

Types

type Link struct {
	Title, Slug string
}

Link is the link given to another post.

type Metadata

type Metadata struct {
	Date  time.Time `yaml:"date"`
	Tags  []string  `yaml:"tags"`
	Title string    `yaml:"title"`
	Draft bool      `yaml:"draft"`
}

Metadata contains the metadata extracted from the frontmatter of the post.

type Post

type Post struct {
	Meta     Metadata
	Body     string
	FilePath string

	// Links here only contains the links mentioned in the body.
	// These are not all the links to/from this post, since we need
	// to derive those from the graph.
	Links       []Link
	Connections []Link
}

Post contains all the necessary things to render a post.

func NewPost

func NewPost(path string) Post

NewPost returns a new Post

func ReadFiles

func ReadFiles(directory string) ([]Post, error)

ReadFiles reads the given directory and appends into given posts

Jump to

Keyboard shortcuts

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