frontmatter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFrontmatter

func HasFrontmatter(markdown string) bool

HasFrontmatter frontmatterが存在するかチェック

func RemoveFrontmatter

func RemoveFrontmatter(markdown string) string

RemoveFrontmatter frontmatterを削除したコンテンツを取得

Types

type ParseResult

type ParseResult struct {
	Frontmatter map[string]interface{} // frontmatterの内容
	Content     string                 // frontmatter以降のMarkdownコンテンツ
	StartPos    int                    // frontmatterの開始位置
	EndPos      int                    // frontmatterの終了位置
}

ParseResult パース結果

type Parser

type Parser struct{}

Parser frontmatterパーサー

func NewParser

func NewParser() *Parser

NewParser 新しいパーサーを作成

func (*Parser) ExtractFrontmatterOnly

func (p *Parser) ExtractFrontmatterOnly(markdown string) (string, bool)

ExtractFrontmatterOnly frontmatterのみを文字列として抽出

func (*Parser) GetNotionPageID

func (p *Parser) GetNotionPageID(fm map[string]interface{}) string

GetNotionPageID frontmatterからNotionページIDを取得

func (*Parser) GetTitle

func (p *Parser) GetTitle(fm map[string]interface{}) string

GetTitle frontmatterからタイトルを取得

func (*Parser) Parse

func (p *Parser) Parse(markdown string) (*ParseResult, error)

Parse Markdownからfrontmatterを抽出・パース

func (*Parser) ParseFile

func (p *Parser) ParseFile(r io.Reader) (*ParseResult, error)

ParseFile ファイルからfrontmatterをパース

type Updater

type Updater struct{}

Updater frontmatter更新器

func NewUpdater

func NewUpdater() *Updater

NewUpdater 新しいアップデーターを作成

func (*Updater) UpdateMultipleFields

func (u *Updater) UpdateMultipleFields(filePath string, fields map[string]interface{}) error

UpdateMultipleFields 複数のフィールドを一度に更新

func (*Updater) UpdateNotionPageID

func (u *Updater) UpdateNotionPageID(filePath string, pageID string) error

UpdateNotionPageID ファイルのfrontmatterにNotionページIDを書き込む

func (*Updater) UpdateNotionPageIDInMemory

func (u *Updater) UpdateNotionPageIDInMemory(markdown string, pageID string) (string, error)

UpdateNotionPageIDInMemory メモリ上のMarkdownにNotionページIDを書き込む

Jump to

Keyboard shortcuts

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