docsify/packages/docsify-server-renderer
2019-02-19 11:26:53 +08:00
..
.gitignore feat: init ocsify-server-renderer 2017-05-30 04:28:30 +08:00
index.js refactor: build config (#408) 2018-03-03 22:51:27 +08:00
package-lock.json [build] 4.9.0 2019-02-19 11:26:53 +08:00
package.json [build] 4.9.0 2019-02-19 11:26:53 +08:00
README.md chore: update german docs, fix links (#560) 2018-07-01 13:48:44 +08:00

docsify-server-renderer

Install

yarn add docsify-server-renderer

Usage

var Renderer = require('docsify-server-renderer')
var readFileSync = require('fs').readFileSync

// init
var renderer = new Renderer({
  template: readFileSync('./docs/index.template.html', 'utf-8').,
  config: {
    name: 'docsify',
    repo: 'docsifyjs/docsify'
  }
})

renderer.renderToString(url)
  .then(html => {})
  .catch(err => {})

index.template.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>docsify</title>
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css" title="buble" disabled>
</head>
<body>
  <!--inject-app-->
  <!--inject-config-->
  <script src="//unpkg.com/docsify/lib/docsify.js"></script>
</body>
</html>