{"id":15661390,"url":"https://github.com/egoist/post-loader","last_synced_at":"2025-05-05T22:02:09.922Z","repository":{"id":45275234,"uuid":"83445578","full_name":"egoist/post-loader","owner":"egoist","description":"Webpack loader for blog posts written in Markdown.","archived":false,"fork":false,"pushed_at":"2021-12-25T14:15:14.000Z","size":71,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T09:44:56.416Z","etag":null,"topics":["blog","loader","markdown","post","web","webpack","yaml"],"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/egoist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-28T15:02:12.000Z","updated_at":"2017-03-22T14:40:54.000Z","dependencies_parsed_at":"2022-08-30T13:01:47.175Z","dependency_job_id":null,"html_url":"https://github.com/egoist/post-loader","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fpost-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fpost-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fpost-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fpost-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egoist","download_url":"https://codeload.github.com/egoist/post-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252442509,"owners_count":21748451,"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":["blog","loader","markdown","post","web","webpack","yaml"],"created_at":"2024-10-03T13:27:18.656Z","updated_at":"2025-05-05T22:02:09.884Z","avatar_url":"https://github.com/egoist.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# post-loader\n\n[![NPM version](https://img.shields.io/npm/v/post-loader.svg?style=flat)](https://npmjs.com/package/post-loader) [![NPM downloads](https://img.shields.io/npm/dm/post-loader.svg?style=flat)](https://npmjs.com/package/post-loader) [![Build Status](https://img.shields.io/circleci/project/egoist/post-loader/master.svg?style=flat)](https://circleci.com/gh/egoist/post-loader) [![codecov](https://codecov.io/gh/egoist/post-loader/branch/master/graph/badge.svg)](https://codecov.io/gh/egoist/post-loader) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000\u0026style=flat)](https://github.com/egoist/donate)\n\n## Install\n\n```bash\nyarn add post-loader --dev\n```\n\n## Usage\n\n```js\nconst postLoader = require('post-loader')\n\nmodule.exports = {\n  module: {\n    rules: [{\n      test: /\\.md$/,\n      loader: 'post-loader'\n    }]\n  }\n}\n```\n\n## Example\n\nGiven `my-blog-post.md`:\n\n```markdown\n---\ntitle: hello there\n---\npost **body**\n```\n\nYields:\n\n```js\n{\n  \"data\": {\n    \"title\": \"hello there\",\n    \"date\": \"2017-02-28T14:57:59.000Z\"\n  },\n  \"content\": \"post **body**\",\n  \"html\": null\n}\n```\n\nWhich is `require-able` in other files:\n\n```js\nimport post from './my-blog-post.md'\n\nconsole.log(post.data.title)\n//=\u003e hello there\n```\n\n*Note:* We automatically set `date` to the birthtime of the file if no `date` is set in front-matter.\n\n## Use a markdown parser\n\n```js\nconst postLoader = require('post-loader')\n\nmodule.exports = {\n  module: {\n    rules: [{\n      test: /\\.md$/,\n      loader: 'post-loader',\n      options: {\n        render(markdown) {\n          return someMarkdownParser.toHTML(markdown)\n        }\n      }\n    }]\n  }\n}\n```\n\nGiven the same markdown content as used above, it yields:\n\n```js\n{\n  \"data\": {\n    \"title\": \"hello there\",\n    \"date\": \"2017-02-28T14:57:59.000Z\"\n  },\n  \"content\": \"post **body**\",\n  \"html\": \"\u003cp\u003epost \u003cstrong\u003eoptions\u003c/strong\u003e\u003c/p\u003e\\\\\\\\n\\\\\"\n}\n```\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n\n## Author\n\n**post-loader** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.\u003cbr\u003e\nAuthored and maintained by egoist with help from contributors ([list](https://github.com/egoist/post-loader/contributors)).\n\n\u003e [egoistian.com](https://egoistian.com) · GitHub [@egoist](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fpost-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegoist%2Fpost-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fpost-loader/lists"}