pipeline

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: GPL-3.0 Imports: 21 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) error

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

func SyntaxHighlighter added in v0.4.1

func SyntaxHighlighter(html []byte, syntaxStyle string) (string, error)

SyntaxHighlighter Highlights any code-blocks from the Generated HTML files(from markdown) based on the style defined in the pygmentsStyle key in zettel.toml file It takes in the rendered HTML from markdown, parses it and selects the code blocks within the <code></code> tag and the language from the tag's class It tokenizes the code based on the language and applies highlighting. It uses styles from the chroma library in Go

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