{"id":13493436,"url":"https://github.com/benjycui/bisheng","last_synced_at":"2025-05-14T05:11:28.048Z","repository":{"id":37931927,"uuid":"56841559","full_name":"benjycui/bisheng","owner":"benjycui","description":"Transform Markdown(and other static files with transformers) into a SPA website using React.","archived":false,"fork":false,"pushed_at":"2023-09-26T06:51:50.000Z","size":2671,"stargazers_count":2900,"open_issues_count":59,"forks_count":419,"subscribers_count":64,"default_branch":"master","last_synced_at":"2025-05-04T00:32:26.822Z","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/benjycui.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,"governance":null}},"created_at":"2016-04-22T08:55:28.000Z","updated_at":"2025-05-02T03:04:15.000Z","dependencies_parsed_at":"2023-10-20T18:22:16.882Z","dependency_job_id":null,"html_url":"https://github.com/benjycui/bisheng","commit_stats":{"total_commits":709,"total_committers":32,"mean_commits":22.15625,"dds":0.2764456981664316,"last_synced_commit":"0908f6f9684fce3872023837e86dae83fd6cb612"},"previous_names":[],"tags_count":125,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fbisheng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fbisheng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fbisheng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjycui%2Fbisheng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjycui","download_url":"https://codeload.github.com/benjycui/bisheng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"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-07-31T19:01:15.192Z","updated_at":"2025-05-14T05:11:23.038Z","avatar_url":"https://github.com/benjycui.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Static Site Generators"],"sub_categories":[],"readme":"# Bi Sheng\n\n[![](https://img.shields.io/travis/benjycui/bisheng.svg?style=flat-square)](https://travis-ci.org/benjycui/bisheng)\n[![Build status](https://ci.appveyor.com/api/projects/status/lu5ut8vphqdfbxhi?svg=true)](https://ci.appveyor.com/project/benjycui/bisheng)\n[![npm package](https://img.shields.io/npm/v/bisheng.svg?style=flat-square)](https://www.npmjs.org/package/bisheng)\n[![NPM downloads](http://img.shields.io/npm/dm/bisheng.svg?style=flat-square)](https://npmjs.org/package/bisheng)\n[![Dependency Status](https://david-dm.org/benjycui/bisheng.svg?style=flat-square)](https://david-dm.org/benjycui/bisheng)\n\n\u003e [Bi Sheng](https://en.wikipedia.org/wiki/Bi_Sheng) was the Chinese inventor of the first known movable type technology.\n\n`bisheng` is designed to transform [Markdown](https://en.wikipedia.org/wiki/Markdown)(and other static files with transformers) into static websites and blogs using [React](https://facebook.github.io/react/).\n\n## Sites built with BiSheng\n\n* [A simple blog](http://benjycui.github.io/bisheng/)\n* [Ant Design](http://ant.design)\n* [Ant Motion](http://motion.ant.design)\n* [Ant Design Mobile](http://mobile.ant.design/)\n* [Ant Financial Design Platform](https://design.alipay.com/)\n* [React AMap](https://elemefe.github.io/react-amap/articles/start)\n\nYou can create a PR to extend this list with your amazing website which is built with BiSheng.\n\n## Features\n\n`bisheng` is based on [dora](https://github.com/dora-js/dora) \u0026 [webpack](https://webpack.github.io/) \u0026 [React](https://facebook.github.io/react/) \u0026 [react-router](https://github.com/ReactTraining/react-router), and it has the following features:\n\n* Support [`browserHistory`](https://github.com/ReactTraining/react-router/blob/v3/docs/API.md#browserhistory), even in [GitHub Pages](https://pages.github.com/).\n* Lazy load for Markdown data.\n* [Plugin](https://github.com/benjycui/bisheng/blob/master/docs/plugin.md) system to extend default behaviour.\n* Server-side render for SEO.\n* Support [`react-helmet`](https://github.com/nfl/react-helmet) for better SEO.\n\n## Big picture\n\n![Big picture of BiSheng](https://raw.githubusercontent.com/benjycui/bisheng/master/big-picture.jpg)\n\n### Articles\n\n* [bisheng-sourceCode-plugin](https://github.com/liangklfangl/bisheng-sourceCode-plugin)\n\n## Usage\n\nInstallation:\n\n```bash\nnpm install --save-dev bisheng\n```\n\nThen, add `start` to [npm scripts](https://docs.npmjs.com/misc/scripts):\n\n```json\n{\n  \"scripts\": {\n    \"start\": \"bisheng start\"\n  }\n}\n```\n\nCreate `bisheng.config.js`, otherwise `bisheng` will use the default config:\n\n```js\nmodule.exports = {\n  source: './posts',\n  output: './_site',\n  theme: './_theme',\n  port: 8000,\n};\n```\n\n**Note:** please make sure that `source` and `theme` exists, and `theme` should not be an empty directory. Just use [bisheng-theme-one](https://github.com/benjycui/bisheng/tree/master/packages/bisheng-theme-one), if you don't know how to develop a theme. See a simple demo [here](https://github.com/benjycui/bisheng/tree/master/packages/bisheng-example).\n\nNow, just run `npm start`.\n\n## Documentation\n\n### CLI\n\nWe can install `bisheng` as a cli command and explore what it can do by `bisheng -h`. However, the recommended way to use `bisheng` is to install it as `devDependencies`.\n\n```bash\n$ npm install -g bisheng\n$ bisheng -h\n  Usage: bisheng [command] [options]\n\n  Commands:\n\n    start [options]     to start a server\n    build [options]     to build and write static files to `config.output`\n    gh-pages [options]  to deploy website to gh-pages\n    help [cmd]          display help for [cmd]\n\n  Options:\n\n    -h, --help     output usage information\n    -V, --version  output the version number\n```\n\n### Configuration\n\n`bisheng` will read `bisheng.config.js` as its config file, but we can set the config file name by `--config`, something like this `bisheng --config another.config.js`.\n\nThe content of `bisheng.config.js` looks like this:\n\n```js\nmodule.exports = {\n  port: 8000,\n  source: './posts',\n  output: './_site',\n  theme: './_theme',\n  htmlTemplate: path.join(__dirname, '../template.html'),\n  devServerConfig: {},\n  webpackConfig(config) {\n    return config;\n  },\n  hash: false,\n\n  entryName: 'index',\n  root: '/',\n};\n```\n\n#### port: Number\n\n\u003e default: 8000\n\nTo set the port which will be listened when we start a local server.\n\n#### source: String | Array[String] | Object{ [category]: String | Array[String]}\n\n\u003e default: './posts'\n\nTo set directory/directories where we place Markdown files.\n\nAnd all the Markdown files in `source` will be parsed and then structured as a tree data, for example:\n\n```bash\nposts\n└── dir1\n  ├── a.md\n  └── b.md\n```\n\nWill output a **Markdown data tree**:\n\n```js\n{\n  dir1: {\n    a: {...},\n    b: {...},\n  },\n}\n```\n\nAnd each Markdown file will be parsed as a **Markdown data**. Actually, a Markdown data is the returned value of [mark-twain](https://github.com/benjycui/mark-twain), and it could be preprocessed by plugins.\n\n#### exclude: RegExp\n\n\u003e default: null\n\nIf you want to exclude some files in your `source`, just use `exclude`. Then bisheng will not parse files which match `exclude`.\n\n#### output: String\n\n\u003e default: './_site'\n\nTo set directory where `bisheng` will generate (HTML \u0026 CSS \u0026 JavaScript) files to.\n\n#### theme: String\n\n\u003e default: './_theme'\n\nTo set directory where we put the theme of website, and it also can be a npm package name.\n\n[**More about theme**](https://github.com/benjycui/bisheng/tree/master/docs/theme.md).\n\n* [bisheng-theme-one](https://github.com/benjycui/bisheng/tree/master/packages/bisheng-theme-one)\n\n#### themeConfig: any\n\n\u003e undefined\n\nA set of configuration that your theme provides, and then your theme can read it from `props.themeConfig`.\n\n\u003e Note: `themeConfig` will be `JSON.stringify` before it's passed to props, so you cannot pass function/RegExp through `themeConfig`.\n\n#### htmlTemplate: String\n\n\u003e default: [`bisheng/lib/template.html`](https://github.com/benjycui/bisheng/blob/master/packages/bisheng/src/template.html)\n\nThe HTML template which will be use to generate HTML files which will be sent to users.\n\n**Note:** template will be parsed by [nunjucks](https://mozilla.github.io/nunjucks/), and you can use the following variables in this template:\n\n* [`root`](https://github.com/benjycui/bisheng#root-string)\n* all attribute of [htmlTemplateExtraData](#htmltemplateextradata-object)\n\n#### htmlTemplateExtraData: Object\n\n\u003e default: `{}`\n\nThe Extra Data which will be used to render [htmlTemplate](#htmltemplate-string).\n\n#### devServerConfig: Object\n\n\u003e default: {}\n\nYou can consult [webpack-dev-server's documentation](https://webpack.js.org/configuration/dev-server/).\n\n#### postcssConfig: Object\n\n```js\ndefault: {\n    plugins: [\n      rucksack(),\n      autoprefixer({\n        browsers: ['last 2 versions', 'Firefox ESR', '\u003e 1%', 'ie \u003e= 8', 'iOS \u003e= 8', 'Android \u003e= 4'],\n      }),\n    ],\n  }\n```\n\n\nYou can consult [webpack postcss-loader's documentation](https://webpack.js.org/loaders/postcss-loader/#options).\n\n#### webpackConfig: (config) =\u003e config\n\n\u003e default: (config) =\u003e config\n\nTo modify the webpack config, you can extend the config like [this](https://github.com/ant-tool/atool-build#配置扩展).\n\n#### transformers: Object[]\n\n\u003e [{ test: /\\.md$/, use: [MarkdownTransformer](https://github.com/benjycui/bisheng/blob/master/packages/bisheng/src/transformers/markdown.js) }]\n\nA list of transformers that will be used to transform static files.\n\n#### entryName: String\n\n\u003e default: 'index'\n\nThe name of files which will be generated by webpack, such as `[entryName].js` \u0026 `[entryName].css`.\n\n#### root: String\n\n\u003e default: '/'\n\nIf the website will be deployed under a sub-directory of a domain (something like `http://benjycui.github.io/bisheng-theme-one/`), we must set it (such as `/bisheng-theme-one/`).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjycui%2Fbisheng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjycui%2Fbisheng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjycui%2Fbisheng/lists"}