{"id":13911250,"url":"https://github.com/rpearce/parse-md","last_synced_at":"2025-10-23T07:30:47.933Z","repository":{"id":1876269,"uuid":"45084979","full_name":"rpearce/parse-md","owner":"rpearce","description":"Parse Markdown file's metadata from its content","archived":false,"fork":false,"pushed_at":"2023-01-07T17:36:16.000Z","size":866,"stargazers_count":40,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-07T04:05:53.275Z","etag":null,"topics":["markdown","markdown-metadata","markdown-parser","markdown-yaml","metadata","parsing"],"latest_commit_sha":null,"homepage":"https://github.com/rpearce/parse-md","language":"TypeScript","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/rpearce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":"rpearce"}},"created_at":"2015-10-28T02:56:13.000Z","updated_at":"2024-12-18T11:48:12.000Z","dependencies_parsed_at":"2023-01-13T11:27:50.016Z","dependency_job_id":null,"html_url":"https://github.com/rpearce/parse-md","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpearce%2Fparse-md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpearce%2Fparse-md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpearce%2Fparse-md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rpearce%2Fparse-md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rpearce","download_url":"https://codeload.github.com/rpearce/parse-md/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237793943,"owners_count":19367422,"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":["markdown","markdown-metadata","markdown-parser","markdown-yaml","metadata","parsing"],"created_at":"2024-08-07T00:02:03.425Z","updated_at":"2025-10-23T07:30:47.526Z","avatar_url":"https://github.com/rpearce.png","language":"TypeScript","funding_links":["https://github.com/sponsors/rpearce"],"categories":["TypeScript"],"sub_categories":[],"readme":"# parseMD\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) [![npm version](https://img.shields.io/npm/v/parse-md.svg?style=flat-square)](https://www.npmjs.com/package/parse-md) [![npm downloads](https://img.shields.io/npm/dm/parse-md.svg?style=flat-square)](https://www.npmjs.com/package/parse-md) [![bundlephobia size](https://flat.badgen.net/bundlephobia/minzip/parse-md)](https://bundlephobia.com/result?p=parse-md)\n\nThis library exists as a way to pass a markdown file's content and have its\nmetadata and markdown returned as an object containing `metadata` and `content`\nkeys.\n\nNote that it is not trying to do anything but solve the markdown metadata vs.\ncontent parsing problem and is _not parsing the markdown body, itself._ You can\nuse something like [marked](https://github.com/chjj/marked) for that.\n\n## What It Does\n\nFor example,\n\n```md\n---\ntitle: This is a test\ndescription: Once upon a time...\n---\n# Title of my great post\nLorem ipsum dolor...\n```\n\nwould be parsed as\n\n```js\n{\n  metadata: {\n    title: \"This is a test\",\n    description: \"Once upon a time...\"\n  },\n  content: \"# Title of my great post\\nLorem ipsum dolor...\"\n}\n```\n\n_Note: This tool expects that your Markdown metadata has `---` boundaries, as\nshown above._\n\n## Usage\n\nInstallation:\n\n```sh\nnpm i parse-md\n```\n\nImport it where you need it, and then pass it a Markdown file's content:\n\n```javascript\nimport fs from 'fs'\nimport parseMD from 'parse-md'\n\nconst fileContents = fs.readFileSync('posts/first.md', 'utf8')\nconst { metadata, content } = parseMD(fileContents)\n\nconsole.log(metadata) // { title: 'Great first post', description: 'This is my first great post. Rawr' }\nconsole.log(content) // \"# My first post...\"\n```\n\n## Links\n\n* [`Changelog`](./CHANGELOG.md)\n* [`Contributing`](./CONTRIBUTING.md)\n* [`Code of Conduct`](./CODE_OF_CONDUCT.md)\n\n## Note about CommonJS\n\nIf you need to CommonJS module support, use version `2.x`, and require it like\nthis:\n\n```javascript\nconst parseMD = require('parse-md').default\n```\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://robertwpearce.com\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/592876?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRobert Pearce\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Robert Pearce \u003cme@robertwpearce.com\u003e/parse-md/commits?author=rpearce\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/Robert Pearce \u003cme@robertwpearce.com\u003e/parse-md/commits?author=rpearce\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-rpearce\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"#ideas-rpearce\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/Robert Pearce \u003cme@robertwpearce.com\u003e/parse-md/commits?author=rpearce\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.justinchan.ca\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/45015017?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJustin Chan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Robert Pearce \u003cme@robertwpearce.com\u003e/parse-md/issues?q=author%3Ajustinchan23\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://www.alexghr.me\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3816165?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlex Gherghisan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Robert Pearce \u003cme@robertwpearce.com\u003e/parse-md/commits?author=alexghr\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/Robert Pearce \u003cme@robertwpearce.com\u003e/parse-md/issues?q=author%3Aalexghr\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"#ideas-alexghr\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpearce%2Fparse-md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frpearce%2Fparse-md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frpearce%2Fparse-md/lists"}