markdown

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCollectionIndex

func BuildCollectionIndex(docs []*Document, baseURL string) map[string]interface{}

BuildCollectionIndex creates a schema.org CollectionPage index

func SerializeJSONLD

func SerializeJSONLD(jsonld map[string]interface{}) ([]byte, error)

SerializeJSONLD serializes JSON-LD to formatted JSON

func ValidateFrontmatter

func ValidateFrontmatter(fm Frontmatter) error

ValidateFrontmatter validates frontmatter against required fields

Types

type Document

type Document struct {
	Frontmatter Frontmatter
	Content     string // Raw markdown content
	HTML        string // Rendered HTML
	FilePath    string // Path to the source file
}

Document represents a parsed markdown document

func ListDocuments

func ListDocuments(contentDir string) ([]*Document, error)

ListDocuments finds all markdown documents in a directory

func ParseDocument

func ParseDocument(filePath string) (*Document, error)

ParseDocument parses a markdown file with YAML frontmatter

func ParseDocumentFromBytes

func ParseDocumentFromBytes(content []byte, filePath string) (*Document, error)

ParseDocumentFromBytes parses markdown content with YAML frontmatter

func (*Document) ToJSONLD

func (d *Document) ToJSONLD(baseURL string) map[string]interface{}

ToJSONLD converts frontmatter to schema.org JSON-LD

type Frontmatter

type Frontmatter struct {
	Title         string      `yaml:"title" json:"title"`
	Description   string      `yaml:"description,omitempty" json:"description,omitempty"`
	DatePublished string      `yaml:"datePublished" json:"datePublished"`
	DateModified  string      `yaml:"dateModified,omitempty" json:"dateModified,omitempty"`
	Author        interface{} `yaml:"author" json:"author"`
	Tags          []string    `yaml:"tags,omitempty" json:"tags,omitempty"`
	Collection    string      `yaml:"collection,omitempty" json:"collection,omitempty"`
	Lang          string      `yaml:"lang" json:"lang"`
	Draft         bool        `yaml:"draft,omitempty" json:"draft,omitempty"`
	Slug          string      `yaml:"slug,omitempty" json:"slug,omitempty"`
	Image         string      `yaml:"image,omitempty" json:"image,omitempty"`
	Keywords      []string    `yaml:"keywords,omitempty" json:"keywords,omitempty"`
}

Frontmatter represents the YAML frontmatter of a document

Jump to

Keyboard shortcuts

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