Giter Club home page Giter Club logo

hexo-theme-book's Introduction


A simple, elegant, book-like hexo theme with some useful features.

book-preview

⚠ Notice

WARNING: this project is no longer maintained, and may have bugs and security issues. Feel free to fork and modify it yourself if you like it. To find the same theme maintained by other developers, check out Useful Forks.

💿 Installation

git clone https://github.com/kaiiiz/hexo-theme-book.git themes/book

If you don't have scss renderer, follow this:

npm install hexo-renderer-scss --save

Modify theme entry in _config.yml

theme: book

Change markdown renderer

For better render quality, I suggest that you should change the default renderer.

The detail, see change markdown renderer

🎈 Update

Jump into the theme folder, run git pull. If you use /source/_data/book.yml, please note the diffrence of updated _config.yml.

Smooth Update

For smoothly updating, I recommand to create a config file named book.yml in /source/_data folder (If it doesn't exist, create one)

Notice: source folder is under your hexo working directory, not the theme one!

Copy the contents of /themes/book/_config.yml to /source/_data/book.yml, it will replace the contents of config in /themes/book/_config.yml. Now you can configure it independently and also, you can update theme more smoothly.

⚒ Configurations

The detail of config, see Configurations

🎁 Features

External Library Integration:

Comments system:

Others:

Code Syntax Highlight:

Using the built-in systax highlight system (highlight.js) supported from hexo itself, so no other configuration is needed.

However, there are multiple themes integrated from tomorrow-theme. You can change the theme in _config.yml.

Normal Night Night Eighties Night Blue Night Bright

Powerful and Fully-Customized Sidebar Menu:

Checkout Menu Realtime Demo

Responsive Layout:

Book will adapt to different viewpoints in order to give you the best reading experience.

hexo-theme-book's People

Contributors

kaiiiz avatar xieyuheng 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

hexo-theme-book's Issues

err: TypeError: Cannot read property 'path' of undefined

when i change theme to book then run hexo g command

yyf@yyf-GP62-2QE:~/superyyf.github.io$ hexo g
INFO Validating config
INFO Start processing
FATAL {
err: TypeError: Cannot read property 'path' of undefined
at Hexo. (/home/yyf/superyyf.github.io/themes/book/scripts/render.js:52:31)
at Hexo.tryCatcher (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/util.js:16:23)
at Hexo. (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/method.js:15:34)
at /home/yyf/superyyf.github.io/node_modules/hexo/lib/extend/filter.js:67:52
at tryCatcher (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/reduce.js:166:18)
at Object.gotAccum (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/reduce.js:155:25)
at Object.tryCatcher (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/yyf/superyyf.github.io/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:461:21)
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

Time under avatar

I want to delete the time under the avatar, do not find a way, please help me, thank you

MarkDown page can't be rendered

The point is that it succeeded, I don't know what the problem is, I need help, please.
there are some configs in my project:
image
image
image

[交流] 添加根据菜单分页的代码

我新增了一个根据菜单分页的代码但是我还修改了其他的代码
我搞不懂这个pull request 如何提交单个文件
我只能把根据菜单分页的代码放在这里

/* global hexo */

'use strict';

hexo.extend.generator.register('post', function (locals) {
  var posts = locals.posts.toArray();
  var pattern = /(?<=\(\/).*?(?=\))/g;
  var titlePattern = /(?<=\[).*(?=\])/g;
  var menu = hexo.theme.config.menu_page;
  var pages = hexo.locals.get('pages')
  var match;
  var matchTitle;
  pages.forEach(function(page){
    if(page.source ===  menu) {
     match= page.raw.match(pattern);
     matchTitle = page.raw.match(titlePattern);
      if(match.length!=matchTitle.length){
        throw TypeError("两个匹配的不相同",match,matchTitle);
      }
    }
  })
  return locals.posts.map(function (post, i) {
    post.hasNext=post.hasPrev = true;
    var current =match.indexOf(post.slug);
    if(current!=-1){
      post.nextPath = match[current+1]||null;
      post.nextTitle = matchTitle[current+1]||null;
      post.prevPath = match[current-1]||null;
      post.prevTitle = match[current-1]||null;
    }
    if(i===0)post.hasPrev = false;
    if(i===locals.posts.length-1) post.hasNext = false;
    return {
      path: post.path,
      data: post,
      layout: 'post'
    };
  });
});

menu generate problem

  1. menu generate by manual , work hard with "hexo-abbrlink" plugin.
  2. we hope menu can generate automatic

Support for Hugo

Hi @kaiiiz this is a great theme! I noticed that you recommended to check out Hugo and I'm wondering if you had a chance to migrate this theme to support Hugo.

Why items under collapsed menu disappear when selected?

my-menu
your-menu

It's very strange that when clicking item the whole menu collapses directly (first image), and in yours item just turns to blue and menu stay unchanged (second image). I doubt some modifications to original theme cause them but after pulling raw theme code these phenomena still exist. And double check path is same as these in menu (e.g. in file system the path is /demo/demo/test.md and in menu it is #demo ##demo *[test](/demo/demo/test/)
Is there any other settings?

node版本的问题

ERROR {
err: Error: Node Sass does not yet support your current environment: OS X Unsupported architecture (arm64) with Unsupported runtime (93)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
at module.exports (/Users/jackfeng/item/hexo_blog_book/node_modules/_node-sass@4.14.1@node-sass/lib/binding.js:13:13)
at Object. (/Users/jackfeng/item/hexo_blog_book/node_modules/_node-sass@4.14.1@node-sass/lib/index.js:14:35)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (/Users/jackfeng/item/hexo_blog_book/node_modules/_hexo-renderer-scss@1.2.0@hexo-renderer-scss/lib/renderer.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at req (/Users/jackfeng/item/hexo_blog_book/node_modules/hexo/lib/hexo/index.js:292:23)
at /Users/jackfeng/item/hexo_blog_book/node_modules/_hexo-renderer-scss@1.2.0@hexo-renderer-scss/index.js:1:81
at /Users/jackfeng/item/hexo_blog_book/node_modules/hexo/lib/hexo/index.js:305:14
at tryCatcher (/Users/jackfeng/item/hexo_blog_book/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/jackfeng/item/hexo_blog_book/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/jackfeng/item/hexo_blog_book/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/jackfeng/item/hexo_blog_book/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/jackfeng/item/hexo_blog_book/node_modules/bluebird/js/release/promise.js:729:18)
} Plugin load failed: %s hexo-renderer-scss

deploy this to github page

hi, you kai, is there any guide to use this theme to github page, I have tried but failed, you can check my repo here: https://github.com/CSLearningPath/CSLearningPath.github.io

the warning message is :

You are attempting to use a Jekyll theme, "themes/hexo-theme-book", which is not supported by GitHub Pages. Please visit https://pages.github.com/themes/ for a list of supported themes. If you are using the "theme" configuration variable for something other than a Jekyll theme, we recommend you rename this variable throughout your site. For more information, see https://docs.github.com/github/working-with-github-pages/adding-a-theme-to-your-github-pages-site-using-jekyll.

any help?

Render failed after commit 91a5b6

I noticed the following error while building the init site with v3.0.0:

$ hexo clean    
INFO  Validating config
INFO  Deleted database.
INFO  Deleted public folder.
$ hexo generate
INFO  Validating config
INFO  Start processing
FATAL {
  err: TypeError: Cannot read property 'path' of undefined
      at Hexo.<anonymous> (/home/chn/Desktop/hexo/themes/book/scripts/render.js:52:31)
      at Hexo.tryCatcher (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/util.js:16:23)
      at Hexo.<anonymous> (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/method.js:15:34)
      at /home/chn/Desktop/hexo/node_modules/hexo/lib/extend/filter.js:67:52
      at tryCatcher (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/reduce.js:166:18)
      at Object.gotAccum (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/home/chn/Desktop/hexo/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

But v2.1.0 works well.

I tried to figure out why. I found that after removing the following code in scripts/render.js at line 51, v3.0.0 works.

hexo.extend.filter.register('after_generate', function () {
  hexo.route.remove(home_file.path);
  hexo.route.remove(menu_file.path);
});

Change default fonts for Chinese

I have changed language in _config.yml into zh, but hexo still use Japanese fonts.

What's more, the location of punctuation is not correct. For example, all comma should be put at the left-bottom corner, not in the middle, like English.

image

I am using dev branch of the theme, commit 28c966.

Thank you for your wonderful theme.

error when hexo g

FATAL {
  err: TypeError: Cannot read property 'path' of undefined
      at Hexo.<anonymous> (/data/data/com.termux/files/home/py.loafing.cn/themes/book/scripts/render.js:52:31)
      at Hexo.tryCatcher (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/util.js:16:23)
      at Hexo.<anonymous> (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/method.js:15:34)
      at /data/data/com.termux/files/home/py.loafing.cn/node_modules/hexo/lib/extend/filter.js:67:52
      at tryCatcher (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/reduce.js:166:18)
      at Object.gotAccum (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/async.js:86:9)              at Async._drainQueues (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/async.js:102:5)      at Immediate.Async.drainQueues [as _onImmediate] (/data/data/com.termux/files/home/py.loafing.cn/node_modules/bluebird/js/release/async.js:15:14)                                         at processImmediate (internal/timers.js:456:21)         } Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

Feature request: markdown-it-container support

Thank you for your great theme.

I noticed the following code in _config.yml in demo.

    - name: markdown-it-container
      options: success
    - name: markdown-it-container
      options: info
    - name: markdown-it-container
      options: warning
    - name: markdown-it-container
      options: danger

But the dev branch does not support these blocks now. Would it be supported soon? I am looking forward to it.

cannot find the markdown file

I wanted to put new items into the menu, but when I clicked the book, it showed cannot find /deep-learning/first-post. have no idea where to fix this.

How to narrow width of posts

Thanks for your awesome theme, and I've found horizontal length of posts is too wide to read in desktop full screen, how to narrow it in this condition?

BUG: menu doesn't work when path contains blank

Assuming there is two post: ThisWorksFine.md and ThisWillNotWorkWith space.md.

menu.md:

# section a
## part a
* [ThisWorksFine](/ThisWorksFine)
* [ThisWillNotWork](/ThisWillNotWorkWith space)
* [ThisAlsoNotWork](/ThisWillNotWorkWith\ space)

I am using the last version of dev branch.

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.