{"id":18434651,"url":"https://github.com/assemble/assemble-yaml","last_synced_at":"2025-04-07T19:31:49.730Z","repository":{"id":10008630,"uuid":"12044759","full_name":"assemble/assemble-yaml","owner":"assemble","description":"Utility for extracting and converting YAML Front Matter from files.","archived":false,"fork":false,"pushed_at":"2020-07-15T20:00:09.000Z","size":30,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-16T02:18:27.008Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/assemble.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-12T00:23:32.000Z","updated_at":"2023-04-13T14:27:08.000Z","dependencies_parsed_at":"2022-08-30T14:01:51.901Z","dependency_job_id":null,"html_url":"https://github.com/assemble/assemble-yaml","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/assemble%2Fassemble-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/assemble","download_url":"https://codeload.github.com/assemble/assemble-yaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247716332,"owners_count":20984221,"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":[],"created_at":"2024-11-06T06:04:47.663Z","updated_at":"2025-04-07T19:31:49.376Z","avatar_url":"https://github.com/assemble.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# assemble-yaml [![NPM version](https://badge.fury.io/js/assemble-yaml.png)](http://badge.fury.io/js/assemble-yaml)  [![Build Status](https://travis-ci.org/assemble/assemble-yaml.png)](https://travis-ci.org/assemble/assemble-yaml)\n\n\u003e Utility library for working with YAML front matter. Works with or without Assemble.\n\nVisit [Assemble's documentation](http://assemble.io) for many more examples and pointers on getting started.\n\n## Getting Started\n```shell\nnpm install assemble-yaml --save\n```\n\nand use it as follows:\n\n```js\nvar yfm = require('assemble-yaml');\n```\n\n\n## Methods\n#### extract\nExtract YAML front matter and content from files.\n\n```js\nvar raw = yfm.extract(\"./file.hbs\", opts);\n```\n**Parameters**:\n\n* `String`: The file to read.\n* `Object`: The options object to pass to [js-yaml](https://github.com/nodeca/js-yaml)\n\n**Returns**:\n\nObject with three properties\n\n```js\n{\n \"context\": {}         // Object. YAML front matter returned as a JSON object.\n \"content\": \"\"         // String. File content, stripped of YAML front matter\n \"originalContent\": \"\" // String. Both content and YAML front matter.\n}\n```\n\n#### context\n\nReturn YAML front matter as a JSON object.\n\n```js\nvar data = yfm.extract(\"./file.hbs\").context;\n```\n\nAlias:\n\n```js\nvar data = yfm.extractJSON(\"./file.hbs\");\n```\n\n#### content\n\nReturn the content of a file, with YAML front matter removed.\n\n```js\nvar content = yfm.extract(\"./file.hbs\").content;\n```\n\nAlias:\n\n```js\nvar data = yfm.stripYFM(\"./file.hbs\");\n```\n\n\n\n## Release History\n\n * 2013-09-27   v0.1.3   Adds extractJSON and stripYFM convenience methods. Add regex to strip extraneous newlines left over after YFM is removed from a file.\n * 2013-09-22   v0.1.2   Adds grunt-readme and grunt-pkg-sync\n * 2013-08-11   v0.1.0   Initial setup - Migrated from main Assemble repo\n \n\n## Author\n\n+ [github.com/doowb](https://github.com/doowb)\n+ [twitter.com/doowb](http://twitter.com/doowb)\n\n## License\nCopyright (c) 2013 Brian Woodward, contributors.\nReleased under the MIT license\n\n***\n\n_This file was generated on Mon Sep 02 2013 09:44:51._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemble%2Fassemble-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassemble%2Fassemble-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemble%2Fassemble-yaml/lists"}