{"id":14155429,"url":"https://github.com/adrg/frontmatter","last_synced_at":"2025-04-13T05:07:08.782Z","repository":{"id":40565103,"uuid":"303207139","full_name":"adrg/frontmatter","owner":"adrg","description":"Go library for detecting and decoding various content front matter formats","archived":false,"fork":false,"pushed_at":"2025-03-25T13:36:00.000Z","size":79,"stargazers_count":144,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T05:07:00.021Z","etag":null,"topics":["decoder","front-matter","front-matter-parser","frontmatter","go","golang","golang-library","golang-package","json","parser","toml","yaml"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/adrg/frontmatter","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"adrgb"}},"created_at":"2020-10-11T20:31:11.000Z","updated_at":"2025-04-09T11:42:01.000Z","dependencies_parsed_at":"2024-01-16T22:18:41.598Z","dependency_job_id":"d65cdbe2-05cd-4b75-aad9-a42e9e1820c6","html_url":"https://github.com/adrg/frontmatter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Ffrontmatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Ffrontmatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Ffrontmatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Ffrontmatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrg","download_url":"https://codeload.github.com/adrg/frontmatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665747,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decoder","front-matter","front-matter-parser","frontmatter","go","golang","golang-library","golang-package","json","parser","toml","yaml"],"created_at":"2024-08-17T08:03:08.007Z","updated_at":"2025-04-13T05:07:08.756Z","avatar_url":"https://github.com/adrg.png","language":"Go","funding_links":["https://ko-fi.com/adrgb","https://ko-fi.com/T6T72WATK"],"categories":["yaml","Go"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/adrg/adrg.github.io/master/assets/projects/frontmatter/logo.png\" width=\"120px\" alt=\"frontmatter logo\"/\u003e\n  \u003c/div\u003e\n  frontmatter\n\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eGo library for detecting and decoding various content front matter formats.\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/adrg/frontmatter/actions/workflows/tests.yml\"\u003e\n        \u003cimg alt=\"Tests status\" src=\"https://github.com/adrg/frontmatter/actions/workflows/tests.yml/badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/adrg/frontmatter\"\u003e\n        \u003cimg alt=\"Code coverage\" src=\"https://codecov.io/gh/adrg/frontmatter/branch/master/graphs/badge.svg?branch=master\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/adrg/frontmatter\"\u003e\n        \u003cimg alt=\"pkg.go.dev documentation\" src=\"https://pkg.go.dev/badge/github.com/adrg/frontmatter\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\" rel=\"nofollow\"\u003e\n        \u003cimg alt=\"MIT License\" src=\"https://img.shields.io/github/license/adrg/frontmatter\"/\u003e\n    \u003c/a\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/adrg/frontmatter\"\u003e\n        \u003cimg alt=\"Go report card\" src=\"https://goreportcard.com/badge/github.com/adrg/frontmatter?style=flat\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/adrg/frontmatter/graphs/contributors\"\u003e\n        \u003cimg alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/adrg/frontmatter\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/adrg/frontmatter/issues?q=is%3Aopen+is%3Aissue\"\u003e\n        \u003cimg alt=\"GitHub open issues\" src=\"https://img.shields.io/github/issues-raw/adrg/frontmatter\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/adrg/frontmatter/issues?q=is%3Aissue+is%3Aclosed\"\u003e\n        \u003cimg alt=\"GitHub closed issues\" src=\"https://img.shields.io/github/issues-closed-raw/adrg/frontmatter\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://ko-fi.com/T6T72WATK\"\u003e\n        \u003cimg alt=\"Buy me a coffee\" src=\"https://img.shields.io/static/v1.svg?label=%20\u0026message=Buy%20me%20a%20coffee\u0026color=579fbf\u0026logo=buy%20me%20a%20coffee\u0026logoColor=white\"/\u003e\n    \u003c/a\u003e\n\n## Supported formats\n\nThe following front matter formats are supported by default. If the default\nformats are not suitable for your use case, you can easily bring your own.\nFor more information, see the [usage examples](#usage) below.\n\n![Default front matter formats](https://raw.githubusercontent.com/adrg/adrg.github.io/master/assets/projects/frontmatter/formats.png)\n\n## Installation\n\n```bash\ngo get github.com/adrg/frontmatter\n```\n\n## Usage\n\n**Default usage.**\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/adrg/frontmatter\"\n)\n\nvar input = `\n---\nname: \"frontmatter\"\ntags: [\"go\", \"yaml\", \"json\", \"toml\"]\n---\nrest of the content`\n\nfunc main() {\n\tvar matter struct {\n\t\tName string   `yaml:\"name\"`\n\t\tTags []string `yaml:\"tags\"`\n\t}\n\n\trest, err := frontmatter.Parse(strings.NewReader(input), \u0026matter)\n\tif err != nil {\n\t\t// Treat error.\n\t}\n\t// NOTE: If a front matter must be present in the input data, use\n\t//       frontmatter.MustParse instead.\n\n\tfmt.Printf(\"%+v\\n\", matter)\n\tfmt.Println(string(rest))\n\n\t// Output:\n\t// {Name:frontmatter Tags:[go yaml json toml]}\n\t// rest of the content\n}\n```\n\n**Bring your own formats.**\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/adrg/frontmatter\"\n\t\"gopkg.in/yaml.v2\"\n)\n\nvar input = `\n...\nname: \"frontmatter\"\ntags: [\"go\", \"yaml\", \"json\", \"toml\"]\n...\nrest of the content`\n\nfunc main() {\n\tvar matter struct {\n\t\tName string   `yaml:\"name\"`\n\t\tTags []string `yaml:\"tags\"`\n\t}\n\n\tformats := []*frontmatter.Format{\n\t\tfrontmatter.NewFormat(\"...\", \"...\", yaml.Unmarshal),\n\t}\n\n\trest, err := frontmatter.Parse(strings.NewReader(input), \u0026matter, formats...)\n\tif err != nil {\n\t\t// Treat error.\n\t}\n\t// NOTE: If a front matter must be present in the input data, use\n\t//       frontmatter.MustParse instead.\n\n\tfmt.Printf(\"%+v\\n\", matter)\n\tfmt.Println(string(rest))\n\n\t// Output:\n\t// {Name:frontmatter Tags:[go yaml json toml]}\n\t// rest of the content\n}\n```\n\nFull documentation can be found at: https://pkg.go.dev/github.com/adrg/frontmatter.\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/adrg/frontmatter.svg)](https://starchart.cc/adrg/frontmatter)\n\n## Contributing\n\nContributions in the form of pull requests, issues or just general feedback,\nare always welcome. See [CONTRIBUTING.MD](CONTRIBUTING.md).\n\n## License\n\nCopyright (c) 2020 Adrian-George Bostan.\n\nThis project is licensed under the [MIT license](https://opensource.org/licenses/MIT).\nSee [LICENSE](LICENSE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrg%2Ffrontmatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrg%2Ffrontmatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrg%2Ffrontmatter/lists"}