百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

goldmark-meta

> 编程语言
开源

YAML 分解器的元数据扩展名 .

99 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

YAML 分解器的元数据扩展名 .

goldmark-meta

GoDev

goldmark-meta is an extension for the goldmark that allows you to define document metadata in YAML format.

Usage

Compatiblity

goldmark-meta/v2 is compatible with goldmark/v2.

Installation

go get github.com/yuin/goldmark-meta/v2

Markdown syntax

YAML metadata block is a leaf block that can not have any markdown element as a child.

YAML metadata must start with a YAML metadata separator. This separator must be at first line of the document.

A YAML metadata separator is a line that only ---.

YAML metadata must end with a YAML metadata separator.

You can define objects as a 1st level item. At deeper level, you can define any kind of YAML element.

Example:

---
Title: goldmark-meta
Summary: Add YAML metadata to the document
Tags:
    - markdown
    - goldmark
---

# Heading 1

Access the metadata

go
import (
    "fmt"
    "github.com/yuin/goldmark/v2/parser"
    "github.com/yuin/goldmark/v2/ast"
    "github.com/yuin/goldmark-meta/v2"
)

func main() {
	source := []byte(`---
Title: goldmark-meta
Summary: Add YAML metadata to the document
Tags:
    - markdown
    - goldmark
---
`)

	document := parser.New(
		parser.WithExtensions(
			meta.Parser,
		),
	).Parse(source)
	metaData := document.(*ast.Document).Metadata()
	title := metaData["Title"]
	fmt.Print(title)
}

Render the metadata as a table

Use meta.WithTable() on the HTML renderer extension:

…

License

MIT

Author

Yusuke Inuzuka

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言