meta

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package meta implements markdown frontmatter parsing for simple folien configuration

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	Theme  string `yaml:"theme"`
	Author string `yaml:"author"`
	Date   string `yaml:"date"`
	Paging string `yaml:"paging"`
}

Meta contains all of the data to be parsed out of a markdown file's header section

func New

func New() *Meta

New creates a new instance of the slideshow meta header object

func (*Meta) Parse

func (m *Meta) Parse(presentation string) (*Meta, bool)

Parse parses metadata from a slideshows header slide including theme information

If no front matter is provided, it will fallback to the default theme and return false to acknowledge that there is no front matter in this slide

Example
package main

import (
	"fmt"

	"github.com/c0rydoras/folien/internal/meta"
)

func main() {
	header := `
---
theme: "dark"
author: "Gopher"
date: "Apr. 4, 2021"
paging: "%d"
---
`
	// Parse the header from the markdown
	// file
	m, _ := meta.New().Parse(header)

	// Print the return theme
	// meta
	fmt.Println(m.Theme)
	fmt.Println(m.Author)
	fmt.Println(m.Date)
	fmt.Println(m.Paging)
}

Jump to

Keyboard shortcuts

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