docsify/packages/docsify-server-renderer
dependabot[bot] 0fcfc4a2eb
chore: bump node-fetch from 2.6.9 to 3.3.1 (#2064)
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.9 to 3.3.1.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.9...v3.3.1)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 15:41:14 +08:00
..
.gitignore feat: init ocsify-server-renderer 2017-05-30 04:28:30 +08:00
index.js chore: Remove dompurify (#1490) 2022-03-08 07:45:23 -06:00
package-lock.json chore: bump node-fetch from 2.6.9 to 3.3.1 (#2064) 2023-05-15 15:41:14 +08:00
package.json chore: bump node-fetch from 2.6.9 to 3.3.1 (#2064) 2023-05-15 15:41:14 +08:00
README.md fix typo (#1309) 2020-07-30 19:09:23 +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, initial-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css" title="vue">
</head>
<body>
  <!--inject-app-->
  <!--inject-config-->
  <script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.js"></script>
</body>
</html>