{"_id":"pagic","_rev":"10-a73c6c3677f10269b08a16d68fbc95eb","name":"pagic","description":"The easiest way to generate static html page from markdown","dist-tags":{"latest":"0.6.0"},"versions":{"0.1.0":{"name":"pagic","version":"0.1.0","description":"The easiest way to generate static html page from markdown","main":"src/index.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"lint":"eslint .","test":"npm run lint"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"commander":"^2.9.0","eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0","find-parent-dir":"^0.3.0","fs-extra":"^2.0.0","glob":"^7.1.1","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"gitHead":"bb6fe88c6db7f5ec6e81453e9905346d3f0fbeb3","_id":"pagic@0.1.0","_shasum":"702d9a0aa0d4aca6c142a93eaa26e677972ccb2c","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"702d9a0aa0d4aca6c142a93eaa26e677972ccb2c","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.1.0.tgz","integrity":"sha512-WFipHCq994213bx1wBQvbHTOCdeI/qHYuI0Vimg1DMx5LtTTaZr8+T9WWBlt/Cp6skedESeaCzAAuiQnWU5KaA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZ8LAA2vXnmrfaqnCpr34Uh788hgZmo73aTtMIIgGQLwIhAJjtin8eaVWXVCLY3+mLif2tGC0REVgrO59W5QYhe1/A"}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pagic-0.1.0.tgz_1488377031752_0.39324243320152164"}},"0.1.1":{"name":"pagic","version":"0.1.1","description":"The easiest way to generate static html page from markdown","main":"src/index.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"lint":"eslint .","test":"npm run lint"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"commander":"^2.9.0","find-parent-dir":"^0.3.0","fs-extra":"^2.0.0","glob":"^7.1.1","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"devDependencies":{"eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0"},"gitHead":"65701c755b49688c8ba3c27bb407fa8aa8785bcc","_id":"pagic@0.1.1","_shasum":"c881bd135b0023c2363d5578440cc6f35f84af48","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"c881bd135b0023c2363d5578440cc6f35f84af48","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.1.1.tgz","integrity":"sha512-PsnDjsrOFwW5FWGQcnINBR2JOS1YLa/aIISqxCEmjIKHFnGy9buhHQTHVw3X3RSBLnjM04Kibibf99ivFSYM6w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGhnzrjpdA7OSXrR8ev3R+zAg/edQUmgtNqVt75iqn7dAiEA5Sgp7J6+HQKZKGcytlZxgfqtb/3jym8tjjiWBJJ+opU="}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pagic-0.1.1.tgz_1488377332506_0.8119833711534739"}},"0.2.0":{"name":"pagic","version":"0.2.0","description":"The easiest way to generate static html page from markdown","main":"src/index.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"start":"node bin/pagic.js -s site","lint":"eslint .","test":"npm run lint"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"commander":"^2.9.0","find-parent-dir":"^0.3.0","front-matter":"^2.1.2","fs-extra":"^2.0.0","glob":"^7.1.1","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"devDependencies":{"eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0"},"gitHead":"88eaf52c55eb20d4b937ce191581f63912e444dc","_id":"pagic@0.2.0","_shasum":"096893c06efe9001e2ef97c4fa80171c47d3e85e","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"096893c06efe9001e2ef97c4fa80171c47d3e85e","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.2.0.tgz","integrity":"sha512-UA3d2raimn/vw+w//vNpo9IN1F2KygyD5ZyYRkEu3qGvVuJjzWRRYQlnAu/GUZkBB1DwoMoL9oLijZk6hbLEag==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGB+nsXzOUFzHiHdVrcYSwyKIk1W+5YJVvqk8R8YwMAeAiEAvqC7RhWRrgpswOrh4/0l/kHbwWtmcDtN+GZBiyGI1lk="}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pagic-0.2.0.tgz_1488463915919_0.6118520726449788"}},"0.3.0":{"name":"pagic","version":"0.3.0","description":"The easiest way to generate static html page from markdown","main":"src/index.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"start":"node bin/pagic.js -s site","lint":"eslint .","test":"npm run lint && mocha"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"commander":"^2.9.0","find-parent-dir":"^0.3.0","front-matter":"^2.1.2","fs-extra":"^2.0.0","glob":"^7.1.1","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"devDependencies":{"chai":"^3.5.0","eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0","mocha":"^3.2.0","proxyquire":"^1.7.11","sinon":"^1.17.7"},"gitHead":"9b55fbfbd04ebe230228bb61931b2b8f2eead66f","_id":"pagic@0.3.0","_shasum":"cdad71c2716467f5de0a456a20e797996907033b","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"cdad71c2716467f5de0a456a20e797996907033b","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.3.0.tgz","integrity":"sha512-9AyaqjnzDhNPsRgEuzREdh3hN/hV+VfJGi2ZkIMvVE1jNyqn5w2gJWmCtg9PaFIk6us8fyqhUAFQhI5XkFhdlQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDDK0vVSv+89fGqPdF7NIsbB57Iy6ufHcGMviFo8ohCVAiEAzLATQQE7/3xt687iZ+NW7xLYJoqDkfXO9yoi+Z+W3mk="}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pagic-0.3.0.tgz_1488549746070_0.16802672413177788"}},"0.4.0":{"name":"pagic","version":"0.4.0","description":"The easiest way to generate static html page from markdown","main":"src/Pagic.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"start":"node bin/pagic.js -s site","lint":"eslint .","test":"npm run lint && _mocha","cover":"istanbul cover node_modules/mocha/bin/_mocha","coveralls":"npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"commander":"^2.9.0","ecstatic":"^2.1.0","find-parent-dir":"^0.3.0","front-matter":"^2.1.2","fs-extra":"^2.0.0","glob":"^7.1.1","js-yaml":"^3.8.2","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"devDependencies":{"chai":"^3.5.0","coveralls":"^2.12.0","eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0","istanbul":"^0.4.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.3.0","proxyquire":"^1.7.11","sinon":"^1.17.7"},"gitHead":"0bac5f56525f90b6fa69dfb881a2c2ed98fb4e7d","_id":"pagic@0.4.0","_shasum":"bee4309ec9520556e3eccbd947d07c53e7f622f4","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"bee4309ec9520556e3eccbd947d07c53e7f622f4","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.4.0.tgz","integrity":"sha512-f/M9Xl002WM3ZQdtLDloLrXnZ+e19BGXYAbAg8OfJqPYDz9LZshDWyRSzLHWt4G8R1soSOYu/kIFUp4sd8w9Qw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNLwUlVPXvVgqodSYHBiyCsRsN9ayo6x0Ecgej7jasbwIhAO1iBki5v2V2VhvMI+QFVx5rnf4WPtzaBOS882maZICQ"}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pagic-0.4.0.tgz_1489137962362_0.16345893521793187"}},"0.4.1":{"name":"pagic","version":"0.4.1","description":"The easiest way to generate static html page from markdown","main":"src/Pagic.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"start":"node bin/pagic.js build","lint":"eslint .","test":"npm run lint && _mocha","cover":"istanbul cover node_modules/mocha/bin/_mocha","coveralls":"npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"commander":"^2.9.0","ecstatic":"^2.1.0","find-parent-dir":"^0.3.0","front-matter":"^2.1.2","fs-extra":"^2.0.0","glob":"^7.1.1","js-yaml":"^3.8.2","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"devDependencies":{"chai":"^3.5.0","coveralls":"^2.12.0","eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0","istanbul":"^0.4.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.3.0","proxyquire":"^1.7.11","sinon":"^1.17.7"},"gitHead":"9355492b1c8341bfd891a6a46c0590333bb2515e","_id":"pagic@0.4.1","_shasum":"9190797895d41915ded0d04c25addc98d3efac7c","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"9190797895d41915ded0d04c25addc98d3efac7c","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.4.1.tgz","integrity":"sha512-+ePuXws7h9r/DFPz67qimkURuXPRRM9JaEGGbEgQ4cL5d+u1wmlqn/YW2K296AMKFK33ndjtGv4sM/yJanCRqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBvYXH/lLfL5AssVeNXj+Z+Dy1fX151THimH7YPj0DxfAiEA80xmH4P94z8w1OyIvqDOXX2snZl+R52N86j5NKEgJgw="}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pagic-0.4.1.tgz_1489221133894_0.1963387164287269"}},"0.5.0":{"name":"pagic","version":"0.5.0","description":"The easiest way to generate static html page from markdown","main":"src/Pagic.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"start":"node bin/pagic.js build -ws","lint":"eslint .","test":"npm run lint && _mocha","cover":"istanbul cover node_modules/mocha/bin/_mocha","coveralls":"npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"chokidar":"^1.6.1","commander":"^2.9.0","ecstatic":"^2.1.0","find-parent-dir":"^0.3.0","front-matter":"^2.1.2","fs-extra":"^2.0.0","glob":"^7.1.1","js-yaml":"^3.8.2","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4"},"devDependencies":{"chai":"^3.5.0","coveralls":"^2.12.0","eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0","istanbul":"^0.4.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.3.0","proxyquire":"^1.7.11","sinon":"^1.17.7"},"gitHead":"48cd39f065f931aa6c2c4531641d289bd0d65b27","_id":"pagic@0.5.0","_shasum":"5153d25fb9ddb2ff2a0b9f6d26aa505b406038d7","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.2.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"5153d25fb9ddb2ff2a0b9f6d26aa505b406038d7","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.5.0.tgz","integrity":"sha512-TZ086Tn6pWUHIuw7JiNysH0FIA9ilVNy9p8ZdPoK6jHtH3IAI76w7ErQrJclq78ncpWy9jLRMVObO6PzppvbBQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEYCthbPWG37MB91DBf8R4c+KmL+bTnQyYH9Q+XP9dmxAiEA5kUg/OPboBlNRcLbvWniN59ZggutL9JqhmFSqgQ5mW4="}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pagic-0.5.0.tgz_1489497690450_0.45355913368985057"}},"0.6.0":{"name":"pagic","version":"0.6.0","description":"The easiest way to generate static html page from markdown","main":"src/Pagic.js","bin":{"pagic":"bin/pagic.js"},"scripts":{"start":"node bin/pagic.js build -ws","lint":"eslint .","test":"npm run lint && _mocha","cover":"istanbul cover node_modules/mocha/bin/_mocha","coveralls":"npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"},"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"keywords":["pagic","static","page","generator","markdown"],"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"homepage":"https://github.com/xcatliu/pagic#readme","dependencies":{"chokidar":"^1.6.1","commander":"^2.9.0","ecstatic":"^2.1.0","find-parent-dir":"^0.3.0","front-matter":"^2.1.2","fs-extra":"^2.0.0","glob":"^7.1.1","js-yaml":"^3.8.2","markdown-it":"^8.3.0","markdown-it-anchor":"^4.0.0","markdown-it-title":"^1.0.4","node-prismjs":"^0.1.0"},"devDependencies":{"chai":"^3.5.0","coveralls":"^2.12.0","eslint":"^3.4.0","eslint-config-airbnb-base":"^5.0.3","eslint-plugin-import":"^1.14.0","istanbul":"^0.4.5","mocha":"^3.2.0","mocha-lcov-reporter":"^1.3.0","proxyquire":"^1.7.11","sinon":"^1.17.7"},"gitHead":"034d4551b85ca8129358951a0ad9390ebbc01344","_id":"pagic@0.6.0","_shasum":"b4870caf6b0832f10292f81b7aa572ae1c2b29fa","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"xcatliu","email":"xcatliu@gmail.com"},"dist":{"shasum":"b4870caf6b0832f10292f81b7aa572ae1c2b29fa","tarball":"https://registry.npmjs.org/pagic/-/pagic-0.6.0.tgz","integrity":"sha512-yZ2w8Xb7Aj9r94c8ENxkbYNuvrrEbYhEsbIuE2dSnO2D/6uRHpWYOd5/c2YS2viNU5zTYxOzwkzPZCKMFu2+sg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuw3qFSvIcQlIajHq+R/wcVzcmLeQ4dyhTILSeHv3pFQIhAIlLGkeNxEhyx9g8620IgnZfaTWNrAimi/U2UB+szzMr"}]},"maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pagic-0.6.0.tgz_1491211803621_0.13573125237599015"}}},"readme":"# Pagic\n\n[![Build Status](https://img.shields.io/travis/xcatliu/pagic.svg)](https://travis-ci.org/xcatliu/pagic) [![npm package](https://img.shields.io/npm/v/pagic.svg)](https://www.npmjs.org/package/pagic) [![npm downloads](http://img.shields.io/npm/dm/pagic.svg)](https://www.npmjs.org/package/pagic) [![Coveralls](https://img.shields.io/coveralls/xcatliu/pagic.svg)](https://coveralls.io/github/xcatliu/pagic)\n\nThe easiest way to generate static html page from markdown\n\n## Features\n\n- [Markdown + Layout => HTML](#markdown--layout--html)\n- [Copy static files](#copy-static-files)\n- [Sub page and sub layout](#sub-page-and-sub-layout)\n- [Front matter](#front-matter)\n- [Yaml config file](#yaml-config-file)\n- [Injected variables](#injected-variables)\n\n## Getting started\n\n### Installation\n\n```bash\nnpm install pagic -g\n```\n\n### Markdown + Layout => HTML\n\nLet's say we have a project like this:\n\n```\ndocs/\n├── public/\n└── src/\n    ├── _layout.js\n    └── index.md\n```\n\nThe `_layout.js` is a simple javascript module which contains a template string:\n\n```js\nmodule.exports = function ({ title, content }) {\n  return `\n    <!doctype html>\n    <html>\n      <head>\n        <title>${title}</title>\n      </head>\n      <body>\n        ${content}\n      </body>\n    </html>\n  `;\n};\n```\n\nThe `index.md` is a simple markdown file:\n\n```markdown\n# Pagic\n\nThe easiest way to generate static html page from markdown\n```\n\nThen run\n\n```bash\npagic build\n```\n\nWe'll get an `index.html` file in `public` directory:\n\n```\ndocs/\n├── public/\n|   └── index.html\n└── src/\n    ├── _layout.js\n    └── index.md\n```\n\nThe content should be:\n\n```html\n<!doctype html>\n<html>\n  <head>\n    <title>Pagic</title>\n  </head>\n  <body>\n    <h1 id=\"pagic\">Pagic</h1>\n    <p>The easiest way to generate static html page from markdown</p>\n  </body>\n</html>\n```\n\nHere we use [markdown-it](https://github.com/markdown-it/markdown-it) with plugins [markdown-it-anchor](https://github.com/valeriangalliat/markdown-it-anchor) and [markdown-it-title](https://github.com/valeriangalliat/markdown-it-title) to parse the markdown file.\n\n### Copy static files\n\nIf there are other static files which are not ended with `.md` or start with `_`, we will simply copy them:\n\n```\ndocs/\n├── public/\n|   ├── css\n|   |   └── site.css\n|   └── index.html\n└── src/\n    ├── css\n    |   └── site.css\n    ├── _layout.js\n    └── index.md\n```\n\n### Sub page and sub layout\n\nWe can have sub directory which contains markdown files.\n\nSub directory can also have a `_layout.js` file.\n\nFor each markdown file, it will walk your file system looking for the nearest `_layout.js` as the template. It starts from the current directory of the markdown file and then moves to the parent directory until it finds the `_layout.js`\n\n```\ndocs/\n├── public/\n|   ├── css\n|   |   └── site.css\n|   └── index.html\n|   └── sub\n|       └── index.html\n└── src/\n    ├── css\n    |   └── site.css\n    ├── _layout.js\n    |── index.md\n    └── sub\n        ├── _layout.js\n        └── index.md\n```\n\n### Front matter\n\nFront matter allows us add extra meta data to markdown:\n\n```markdown\n---\nauthor: xcatliu\npublished: 2017-03-02\n---\n\n# Pagic\n\nThe easiest way to generate static html page from markdown\n```\n\nThen in `_layout.js`, we can get a `frontMatter` object which contains the meta data:\n\n```js\nmodule.exports = function ({ title, content, frontMatter }) {\n  return `\n    <!doctype html>\n    <html>\n      <head>\n        <title>${title}</title>\n      </head>\n      <body>\n        ${content}\n        <footer>\n          Author: ${frontMatter.author},\n          Published: ${frontMatter.published}\n        </footer>\n      </body>\n    </html>\n  `;\n};\n```\n\n### Yaml config file\n\nWe can set the configuration in `_config.yml`, the default is:\n\n```yaml\nsrc_dir: src\npublic_dir: public\n```\n\n### Injected variables\n\nThe variables which are injected to `_layout.js`:\n\n<div class=\"scroll-view\">\n  <table class=\"table\">\n    <thead>\n      <tr>\n        <th>Variable</th>\n        <th>Interpretation</th>\n      </tr>\n    </thead>\n    <tbody>\n      <tr>\n        <td><code>title</code></td>\n        <td>The title of current page, usually is the first <code># Title</code> in the markdown</td>\n      </tr>\n      <tr>\n        <td><code>content</code></td>\n        <td>The content of current page</td>\n      </tr>\n      <tr>\n        <td><code>frontMatter</code></td>\n        <td>The frontMatter object of current markdown</td>\n      </tr>\n      <tr>\n        <td><code>relativeToRoot</code></td>\n        <td>The relative path from current markdown file to root directory</td>\n      </tr>\n      <tr>\n        <td><code>config</code></td>\n        <td>The json format of <code>_config.yml</code>. You can add your custom data to it</td>\n      </tr>\n      <tr>\n        <td><code>filePath</code></td>\n        <td>The current markdown file path</td>\n      </tr>\n    </tbody>\n  </table>\n</div>\n\n## Use Pagic as cli\n\n### `pagic build`\n\nWe can use `pagic build` to build static page, there are some options while using build command:\n\n```bash\npagic build [options]\n\n# -w, --watch  watch src dir change\n# -s, --serve  serve public dir\n# -p, --port   override default port\n```\n\n### `pagic init`\n\nWe can use `pagic init` to create a new Pagic folder:\n\n```bash\npagic init <dir>\n```\n\n## Use Pagic as a node module\n\nIt's also able to use it as a node module:\n\n```bash\nnpm install pagic --save\n```\n\n### Common usage\n\n```js\nconst Pagic = require('pagic');\n\nconst pagic = new Pagic();\npagic.build();\n```\n\n### Watch file change\n\n```js\npagic.watch().build();\n\nsetTimeout(() => {\n  pagic.unwatch();\n}, 10000);\n```\n\n## Development\n\n```bash\nnpm install\nnpm start\nnpm test\n```\n\n## LICENSE\n\n[MIT](./LICENSE)\n\n---\n\nHave fun with pagic!\n","maintainers":[{"name":"xcatliu","email":"xcatliu@gmail.com"}],"time":{"modified":"2022-06-23T08:01:52.095Z","created":"2017-03-01T14:03:53.702Z","0.1.0":"2017-03-01T14:03:53.702Z","0.1.1":"2017-03-01T14:08:54.222Z","0.2.0":"2017-03-02T14:11:56.142Z","0.3.0":"2017-03-03T14:02:26.331Z","0.4.0":"2017-03-10T09:26:02.626Z","0.4.1":"2017-03-11T08:32:15.701Z","0.5.0":"2017-03-14T13:21:30.700Z","0.6.0":"2017-04-03T09:30:05.554Z"},"homepage":"https://github.com/xcatliu/pagic#readme","keywords":["pagic","static","page","generator","markdown"],"repository":{"type":"git","url":"git+https://github.com/xcatliu/pagic.git"},"author":{"name":"xcatliu","email":"xcatliu@gmail.com"},"bugs":{"url":"https://github.com/xcatliu/pagic/issues"},"license":"MIT","readmeFilename":"README.md","users":{"xcatliu":true}}