Giter Site home page Giter Site logo

honkit / honkit Goto Github PK

View Code? Open in Web Editor NEW
2.9K 34.0 214.0 79.12 MB

:book: HonKit is building beautiful books using Markdown - Fork of GitBook

Home Page: https://honkit.netlify.app

License: Apache License 2.0

JavaScript 14.27% HTML 11.32% Shell 0.13% CSS 0.02% TypeScript 64.60% Dockerfile 0.12% Less 9.55%
book plugin gitbook honkit ebook markdown asciidoc javascript

honkit's Introduction

HonKit

HonKit is building beautiful books using GitHub/Git and Markdown.

HonKit Screenshot

Documentation and Demo

HonKit documentation is built by HonKit!

Quick Start

Installation

The best way to install HonKit is via NPM or Yarn.

$ npm init --yes
$ npm install honkit --save-dev

⚠️ Warning:

  • If you have installed honkit globally, you must install each plugins globally as well
  • If you have installed honkit locally, you must install each plugins locally as well

We recommend installing honkit locally.

Create a book

HonKit can set up a boilerplate book:

$ npx honkit init

If you wish to create the book into a new directory, you can do so by running honkit init ./directory

Preview and serve your book using:

$ npx honkit serve

Or build the static website using:

$ npx honkit build

You can start to write your book!

For more details, see HonKit's documentation.

Docker support

Honkit provide docker image at honkit/honkit.

This docker image includes built-in dependencies for PDF/epub.

docker pull honkit/honkit
docker run -v `pwd`:`pwd` -w `pwd` --rm -it honkit/honkit honkit build
docker run -v `pwd`:`pwd` -w `pwd` --rm -it honkit/honkit honkit pdf

For more details, see docker/.

Usage examples

HonKit can be used to create a book, public documentation, enterprise manual, thesis, research papers, etc.

You can find a list of real-world examples in the documentation.

Features

Fork of GitBook

HonKit is a fork of GitBook (Legacy). GitBook (Legacy) is deprecated and an inactive project.

HonKit aims to smooth the migration from GitBook (Legacy) to HonKit.

Compatibility with GitBook

  • Almost all plugins work without changes!
  • Support gitbook-plugin-* packages
    • You should install these plugins via npm or yarn
    • npm install gitbook-plugin-<example> --save-dev

Differences with GitBook

  • Node.js 14+ supports
  • Improve build/serve performance
    • honkit build: use file cache by default
    • honkit serve: 28.2s → 0.9s in examples/benchmark
    • Also, support --reload flag for force refresh
  • Improve plugin loading logic
    • Reduce cost of finding honkit-plugin-* and gitbook-plugin-*
    • Support honkit-plugin-* and @scope/honkit-plugin-* (GitBook does not support a scoped module)
  • Remove install command
    • Instead of it, just use npm install or yarn install
  • Remove global-npm dependency
    • You can use HonKit with another npm package manager like yarn
  • Update dependencies
    • Upgrade to nunjucks@2, highlight.js etc...
    • It will reduce bugs
  • TypeScript
    • Rewritten by TypeScript
  • Monorepo codebase
    • Easy to maintain
  • Docker support

Migration from GitBook

Replace gitbook-cli with honkit.

npm uninstall gitbook-cli
npm install honkit --save-dev

Replace gitbook command with honkit command.

  "scripts": {
-    "build": "gitbook build",
+    "build": "honkit build",
-    "serve": "gitbook serve"
+    "serve": "honkit serve"
  },

After that, HonKit just works!

Examples of migration:

Benchmarks

honkit build benchmark:

Licensing

HonKit is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

HonKit is a fork of GitBook (Legacy). GitBook is licensed under the Apache License, Version 2.0.

Also, HonKit includes bignerdranch/gitbook works.

Sponsors

Deploys by Netlify

honkit's People

Contributors

aarono avatar aschempp avatar azu avatar bebraw avatar citizenmatt avatar codepiano avatar davidagraf avatar dependabot[bot] avatar deviantintegral avatar dogatana avatar embreinhardt avatar erixtekila avatar frodsan avatar ggrossetie avatar github-actions[bot] avatar hugodf avatar iamolivinius avatar jpreynat avatar kentaroutakeda avatar masnagam avatar mizchi avatar nghong avatar practicalli-johnny avatar rlmv avatar samypesse avatar satoshicano avatar shaform avatar soreine avatar tcorral avatar zwaldowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

honkit's Issues

test: integration test

In my experience, integration test is useful on large CLI project.
The best is that use actual project for testing.
It help us to find regression bug.

e.g. https://github.com/textlint/textlint/tree/master/test/integration-test

HonKit output is HTML,JS,CSS files.
So, We can add snapshot testing using actual project.

However, snapshot file(Its just _book dir) is large. I think we have to come up with a good idea.

Start to small example project, Use GitHub Actions and artifact, put separacted repository...

gitbook-plugin-uml does not work

Summary

https://github.com/vowstar/gitbook-plugin-uml does not work on Honkit

  • HonKit version: 3.3.10

Step to reproduce

Expected results

Render the uml correctly.

Actual results

Rendering error.

Note

https://github.com/vowstar/gitbook-plugin-uml/blob/99ad7443d2a2c051c2327c7ebda63a0ca19f1621/index.js#L41
Dump the code variable and I noticed the differnece between GitBook and HonKit

GitBook

@startuml

    Class Stage
    Class Timeout {
        +constructor:function(cfg)
        +timeout:function(ctx)
        +overdue:function(ctx)
        +stage: Stage
    }
    Stage <|-- Timeout

@enduml

HonKit

@startuml

```
Class Stage
Class Timeout {
    +constructor:function(cfg)
    +timeout:function(ctx)
    +overdue:function(ctx)
    +stage: Stage
}
Stage <|-- Timeout
```

@enduml

Reduce Immutable.js

Reduce usage of Immutable is meaningful.

Immutablity is good, but Immutable.js is hard.

Immutable is important, but base class should not base on JavaScript framework like Immutable.js.
Pure domain object model is better and use helper library is ok.
For example, immutable-array-prototype help model to manupulate array as immutable.

Docker support

We need to provide docker image.

Would be nice like that

$ docker run --rm -it honkit/honkit honkit build
$ docker run --rm -it honkit/honkit honkit serve
$ docker run --rm -it honkit/honkit honkit pdf # need ebook-convert 

📝 Need to publish from CI like https://github.com/secretlint/secretlint/blob/master/.github/workflows/publish-artifact.yml
Dependency order: publish npm → push Docker Image

UseCase

  • Non-Node.js user easy to use HonKit
  • Use Docker Image instead of installing ebook-convert into globally

3.3.9 build fail , theme-default version detect error?

Report:

Try convert from gitbook to githon.
https://github.com/tsuyoshicho/WhenScarletIceMelted/tree/feature/githon

Setup and npm install success for githon 3.3.9 and others.

But, when npm run build(githon build) phase, error occur.

Platform: Windows, Linux
Node: v14.4.0

`Githon doesn't satisfy the requirements of this plugin: >=4.0.0-alpha`
WhenScarletIceMelted on  feature/githon via ⬢ v14.4.0 took 15s
⏰[ 2020-06-20T07:40:09 ] ❯ npm install

> [email protected] install D:\Data\ReposWork\git\WhenScarletIceMelted\node_modules\node-sass
> node scripts/install.js

Cached binary found at C:\Users\tsuyoshi\AppData\Roaming\npm-cache\node-sass\4.14.1\win32-x64-83_binding.node

> [email protected] postinstall D:\Data\ReposWork\git\WhenScarletIceMelted\node_modules\node-sass
> node scripts/build.js

Binary found at D:\Data\ReposWork\git\WhenScarletIceMelted\node_modules\node-sass\vendor\win32-x64-83\binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 788 packages from 768 contributors and audited 790 packages in 378.876s

60 packages are looking for funding
  run `npm fund` for details

found 3 vulnerabilities (1 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
WhenScarletIceMelted on  feature/githon via ⬢ v14.4.0 took 6m20s
⏰[ 2020-06-20T07:46:34 ] ❯ npm run build

> [email protected] build D:\Data\ReposWork\git\WhenScarletIceMelted
> githon build

info: 9 plugins are installed
info: 9 explicitly listed
info: plugin "creativecommons is loaded
info: plugin "styles-sass-fix is loaded
info: plugin "puml is loaded
info: plugin "highlight is loaded
info: plugin "search is loaded
info: plugin "lunr is loaded
info: plugin "fontsettings is loaded
info: plugin "theme-default is loaded
Githon doesn't satisfy the requirements of this plugin: >=4.0.0-alpha
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `githon build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tsuyoshi\AppData\Roaming\npm-cache\_logs\2020-06-19T22_46_47_721Z-debug.log
exit status 1
WhenScarletIceMelted on  feature/githon via ⬢ v14.4.0 took 2s
⏰[ 2020-06-20T07:46:47 ] ❯

perf: why nunjucks noCache: true?

According my profile, a bottoleneck of honkit build is nunjucks render
#37 worker_thread issue is for that.

I've notices that honkit pass noCache: true to nunjucks. Is it really? (Need to confirm!)

If we will set noCahe: falase, we can make honkit build more fast.

https://mozilla.github.io/nunjucks/api.html#configure

TODO

  • Add profile data: node --inspect --inspect-brk is useful
  • noCache: true is actual used?
    • If it is actual used, why?
  • Change noCache: false if it is possible

docs: concept

  • Stability
  • Maintenanceability
  • Durty hacks but extensiblity

GitHon not aim to get cool features, I think.

Issue Template

we need to get Bug reporting template

  • version
  • book.js
  • log
  • minimal reproduce repo

TypeScript

We want to convert codebase to TypeScript.

New default theme

We consider to new default theme.
Probably, @honkit/honkit-plugin-theme-default(current theme) is still existing in the future for compatiblity.

We want to opt-in new default theme.
It is probably a mechanism that is enabled by adding some settings to book.json.

Releated idea: label:"Type: Theme"

Purpose

  • Fast
  • Stable
  • Extensible

Changes from current default theme

  • Reduce Cumulative Layout Shift #91
    • Remove Sidebar layout storage
    • Remove Font Settings
    • Rendering as server-side, less client-side rendering
  • Reduce library like jQuery
    • But plugins depend on jQuery...
  • Reduce dependency
    • Remove font-awesome #132
  • Use <a> link instead of Pjax

TODO

  • Built-in Search
  • Plugin Compatibility
    • It will probably never be fully compatible. It will provide alternative functions.
  • Opt-in Switch
  • Async Loading for INP
  • View Transition API support?

Usage

HonKit next

Next HonKit major ideas.

It is breaking changes list!

Todo

  • remove asciidoc support MayBe.

Bibliography?

Hi, I have searched for the term "bibliography" in the docs with no avail.
Does honkit support some kind of bibliography?
Similar to LaTeX I mean, the environment I use nowadays, I have tons of .bib files...
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.