Transform Markdown(and other static files with transformers) into a SPA website using React.
Switch branches/tags
bisheng@0.29.0 bisheng@0.28.3 bisheng@0.28.0 bisheng@0.27.8 bisheng@0.27.7 bisheng@0.27.6 bisheng@0.27.5 bisheng@0.27.4 bisheng@0.27.2 bisheng@0.27.1 bisheng@0.26.0 bisheng@0.25.0 bisheng@0.24.2 bisheng@0.24.1 bisheng@0.23.3 bisheng@0.23.2 bisheng@0.23.1 bisheng@0.23.0 bisheng@0.22.7 bisheng@0.22.6 bisheng@0.22.5 bisheng@0.22.4 bisheng@0.22.3 bisheng@0.22.2 bisheng@0.22.1 bisheng@0.22.0 bisheng@0.21.3 bisheng@0.21.2 bisheng@0.21.1 bisheng@0.21.0 bisheng-theme-one@0.2.35 bisheng-theme-one@0.2.34 bisheng-theme-one@0.2.31 bisheng-theme-one@0.2.30 bisheng-theme-one@0.2.29 bisheng-theme-one@0.2.28 bisheng-theme-one@0.2.27 bisheng-theme-one@0.2.26 bisheng-theme-one@0.2.24 bisheng-theme-one@0.2.23 bisheng-theme-one@0.2.21 bisheng-theme-one@0.2.20 bisheng-theme-one@0.2.19 bisheng-theme-one@0.2.18 bisheng-theme-one@0.2.17 bisheng-theme-one@0.2.15 bisheng-theme-one@0.2.14 bisheng-theme-one@0.2.13 bisheng-theme-one@0.2.12 bisheng-theme-one@0.2.11 bisheng-theme-one@0.2.10 bisheng-theme-one@0.2.9 bisheng-theme-one@0.2.8 bisheng-theme-one@0.2.7 bisheng-theme-one@0.2.6 bisheng-theme-one@0.2.5 bisheng-theme-one@0.2.4 bisheng-theme-one@0.2.3 bisheng-theme-one@0.2.2 bisheng-theme-one@0.2.1 bisheng-theme-one@0.2.0 bisheng-plugin-toc@0.4.4 bisheng-plugin-toc@0.4.2 bisheng-plugin-toc@0.4.1 bisheng-plugin-react@0.6.3 bisheng-plugin-react@0.6.1 bisheng-plugin-react@0.6.0 bisheng-plugin-react@0.5.8 bisheng-plugin-react@0.5.7 bisheng-plugin-react@0.5.6 bisheng-plugin-react@0.5.5 bisheng-plugin-react@0.5.4 bisheng-plugin-react@0.5.3 bisheng-plugin-react@0.5.2 bisheng-plugin-react@0.5.1 bisheng-plugin-description@0.1.4 bisheng-plugin-description@0.1.2 bisheng-example@1.0.34 bisheng-example@1.0.33 bisheng-example@1.0.31 bisheng-example@1.0.30 bisheng-example@1.0.29 bisheng-example@1.0.28 bisheng-example@1.0.27 bisheng-example@1.0.26 bisheng-example@1.0.24 bisheng-example@1.0.23 bisheng-example@1.0.21 bisheng-example@1.0.20 bisheng-example@1.0.19 bisheng-example@1.0.18 bisheng-example@1.0.17 bisheng-example@1.0.15 bisheng-example@1.0.14 bisheng-example@1.0.13 bisheng-example@1.0.12 bisheng-example@1.0.11 bisheng-example@1.0.10 bisheng-example@1.0.9 bisheng-example@1.0.8
Nothing to show
Clone or download
benjycui benjycui
benjycui and benjycui Publish
 - bisheng-example@1.0.34
 - bisheng-theme-one@0.2.35
 - bisheng@0.29.0
Latest commit 4c0c58e Jul 3, 2018

README.md

Bi Sheng

Build status npm package NPM downloads Dependency Status

Bi Sheng was the Chinese inventor of the first known movable type technology.

bisheng is designed to transform Markdown(and other static files with transformers) into static websites and blogs using React.

Sites built with BiSheng

You can create a PR to extend this list with your amazing website which is built with BiSheng.

Features

bisheng is based on dora & webpack & React & react-router, and it has the following features:

Big picture

Big picture of BiSheng

Articles

Usage

Installation:

npm install --save-dev bisheng

Then, add start to npm scripts:

{
  "scripts": {
    "start": "bisheng start"
  }
}

Create bisheng.config.js, otherwise bisheng will use the default config:

module.exports = {
  source: './posts',
  output: './_site',
  theme: './_theme',
  port: 8000,
};

Note: please make sure that source and theme exists, and theme should not be an empty directory. Just use bisheng-theme-one, if you don't know how to develop a theme. See a simple demo here.

Now, just run npm start.

Documentation

CLI

We 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.

$ npm install -g bisheng
$ bisheng -h
  Usage: bisheng [command] [options]

  Commands:

    start [options]     to start a server
    build [options]     to build and write static files to `config.output`
    gh-pages [options]  to deploy website to gh-pages
    help [cmd]          display help for [cmd]

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

Configuration

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.

The content of bisheng.config.js looks like this:

module.exports = {
  port: 8000,
  source: './posts',
  output: './_site',
  theme: './_theme',
  htmlTemplate: path.join(__dirname, '../template.html'),
  devServerConfig: {},
  webpackConfig(config) {
    return config;
  },

  entryName: 'index',
  root: '/',
};

port: Number

default: 8000

To set the port which will be listened when we start a local server.

source: String | Array[String] | Object{ [category]: String | Array[String]}

default: './posts'

To set directory/directories where we place Markdown files.

And all the Markdown files in source will be parsed and then structured as a tree data, for example:

posts
└── dir1
  ├── a.md
  └── b.md

Will output a Markdown data tree:

{
  dir1: {
    a: {...},
    b: {...},
  },
}

And each Markdown file will be parsed as a Markdown data. Actually, a Markdown data is the returned value of mark-twain, and it could be preprocessed by plugins.

exclude: RegExp

default: null

If you want to exclude some files in your source, just use exclude. Then bisheng will not parse files which match exclude.

output: String

default: './_site'

To set directory where bisheng will generate (HTML & CSS & JavaScript) files to.

theme: String

default: './_theme'

To set directory where we put the theme of website, and it also can be a npm package name.

More about theme.

themeConfig: any

undefined

A set of configuration that your theme provides, and then your theme can read it from props.themeConfig.

Note: themeConfig will be JSON.stringify before it's passed to props, so you cannot pass function/RegExp through themeConfig.

htmlTemplate: String

default: bisheng/lib/template.html

The HTML template which will be use to generate HTML files which will be sent to users.

Note: template will be parsed by nunjucks, and you can use the following variables in this template:

htmlTemplateExtraData: Object

default: {}

The Extra Data which will be used to render htmlTemplate.

devServerConfig: Object

default: {}

You can consult webpack-dev-server's documentation.

postcssConfig: Object

default: {
    plugins: [
      rucksack(),
      autoprefixer({
        browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'],
      }),
    ],
  }

You can consult wenpack postcss-loader's documentation.

webpackConfig: (config) => config

default: (config) => config

To modify the webpack config, you can extend the config like this.

transformers: Object[]

[{ test: /.md$/, use: MarkdownTransformer }]

A list of transformers that will be used to transform static files.

entryName: String

default: 'index'

The name of files which will be generated by webpack, such as [entryName].js & [entryName].css.

root: String

default: '/'

If 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/).

License

MIT