https://github.com/meff34/docsify-to-pdf-converter
A tool for building pdf based on your docsify project
https://github.com/meff34/docsify-to-pdf-converter
Last synced: 11 months ago
JSON representation
A tool for building pdf based on your docsify project
- Host: GitHub
- URL: https://github.com/meff34/docsify-to-pdf-converter
- Owner: meff34
- Created: 2019-01-14T10:15:22.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T21:14:00.000Z (over 1 year ago)
- Last Synced: 2025-03-03T20:41:21.424Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 442 KB
- Stars: 90
- Watchers: 6
- Forks: 29
- Open Issues: 27
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-starred - meff34/docsify-to-pdf-converter - A tool for building pdf based on your docsify project (others)
- awesome-docsify - docsify-pdf-converter - Create PDF files based on your docsify project [@meff34](https://github.com/meff34). (Plugins)
README
# docsify-pdf-converter
## Install
```sh
npm install --save-dev docsify-pdf-converter
```
## Usage as CLI:
Create:
* config file `.docsifytopdfrc.`
* or `"docsifytopdf"` field in `package.json` (like [rcfile][rcfile] can receive) with this setup object:
Example `.docsifytopdfrc.js` content:
```js
module.exports = {
contents: [ "docs/_sidebar.md" ], // array of "table of contents" files path
pathToPublic: "pdf/readme.pdf", // path where pdf will stored
pdfOptions: "", // reference: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions
removeTemp: true, // remove generated .md and .html or not
emulateMedia: "screen", // mediaType, emulating by puppeteer for rendering pdf, 'print' by default (reference: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageemulatemediamediatype)
}
```
Add script into `package.json`:
```json
{
"scripts": {
"convert": "node_modules/.bin/docsify-pdf-converter"
}
}
```
Run converter:
```sh
npm run convert
```
## Usage as npm-package:
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧
This part of module is not safe for work - it will stop process after generation pdf. Use it for your own risk.
You can just import and use main function like this:
```js
const converter = require('docsify-pdf-converter');
const config = require('./.docsifytopdfrc.js');
converter(config) // right after resolve or reject inner promise your process will be terminated :C
```
🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧
## Contributing
- Fork it!
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request
Your pull requests and issues are welcome!
[rcfile]: https://www.npmjs.com/package/rcfile