{"id":16326640,"url":"https://github.com/izolate/front-matter","last_synced_at":"2025-03-22T21:33:13.321Z","repository":{"id":50130973,"uuid":"190916197","full_name":"izolate/front-matter","owner":"izolate","description":"Extracts YAML front matter from a file or string","archived":false,"fork":false,"pushed_at":"2023-06-28T01:04:55.000Z","size":239,"stargazers_count":5,"open_issues_count":7,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T19:11:19.307Z","etag":null,"topics":["dart","front-matter","markdown","parser","static-site-generator","yaml"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/front_matter","language":"Dart","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/izolate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2019-06-08T17:27:36.000Z","updated_at":"2022-11-11T11:46:32.000Z","dependencies_parsed_at":"2024-10-28T15:35:57.914Z","dependency_job_id":null,"html_url":"https://github.com/izolate/front-matter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izolate%2Ffront-matter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izolate%2Ffront-matter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izolate%2Ffront-matter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izolate%2Ffront-matter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izolate","download_url":"https://codeload.github.com/izolate/front-matter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244246551,"owners_count":20422458,"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":["dart","front-matter","markdown","parser","static-site-generator","yaml"],"created_at":"2024-10-10T23:09:07.991Z","updated_at":"2025-03-22T21:33:13.019Z","avatar_url":"https://github.com/izolate.png","language":"Dart","readme":"# Front Matter\n\nA front matter parser that extracts YAML metadata from the start of a file or string.\n\n[![Build Status](https://travis-ci.org/izolate/front-matter.svg?branch=master)](https://travis-ci.org/izolate/front-matter)\n\nFront matter is a concept heavily borrowed from [Jekyll](https://github.com/jekyll/jekyll), and other static site generators, referring to a block of YAML in the header of a file representing the file's metadata.\n\n## Usage\nSuppose you have the following Markdown file:\n\n```markdown\n---\ntitle: \"Hello, world!\"\nauthor: \"izolate\"\n---\n\nThis is an example.\n```\n\nUse `parse` to parse a string, or `parseFile` to read a file and parse its contents.\n\n```dart\nimport 'dart:io';\nimport 'package:front_matter/front_matter.dart' as fm;\n\n// Example 1 - parse a string.\nvoid example1() async {\n  var file = File('/path/to/file.md');\n  var fileContents = await file.readAsString();\n  var doc = fm.parse(fileContents);\n  \n  print(doc.data['title']); // \"Hello, world!\"\n  print(doc.content);       // \"This is an example.\"\n}\n\n// Example 2 - read file and parse contents.\nvoid example2() async {\n  var doc = await fm.parseFile('path/to/file.md');\n\n  print(doc.data['title']); // \"Hello, world!\"\n  print(doc.content);       // \"This is an example.\"\n}\n```\n\nThe returned document is an instance of `FrontMatterDocument` with properties:\n* `YamlMap data` - The front matter.\n* `String content` - The content body.\n\nTo convert the document back to the initial string value, call `toString()`.\n\n```dart\nvar text = '---\\nfoo: bar\\n---\\nHello, world!';\nvar doc = fm.parse(text);\n\nassert(doc.toString(), equals(text)); // true\n```\n\n### API\n\n#### `parse(String text, {String delimiter = \"---\"})`\nParses a string, returns a `FrontMatterDocument` with front matter and body content.\n\n#### `parseFile(String path, {String delimiter = \"---\"})`\nReads a file and parses its contents. Returns a `Future\u003cFrontMatterDocument\u003e` with front matter and body content.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizolate%2Ffront-matter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizolate%2Ffront-matter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizolate%2Ffront-matter/lists"}