forematter

package module
v0.0.0-...-d91195b Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 8 Imported by: 0

README

Forematter

Why

A library to parse frontmatter from input, ignoring the content and spit it out in another format for use.

input: string output: key-value object (struct)

intended usage:

package main

import "github.com/kirontoo/forematter"

func main() {
    data, err := forematter.Parse(input)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TomlFormat = newFormat("+++", toml.Unmarshal)
View Source
var YamlFormat = newFormat("---", yaml.Unmarshal)

Functions

func Parse

func Parse(input string, v interface{})

Types

type Format

type Format struct {
	Delimiter string
	Unmarshal UnmarshalFunc
}

type UnmarshalFunc

type UnmarshalFunc func(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

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