Coder Social home page Coder Social logo

sighingnow / jekyll-gitbook Goto Github PK

View Code? Open in Web Editor NEW
438.0 6.0 924.0 2.39 MB

Build Jekyll site with GitBook style!

Home Page: https://sighingnow.github.io/jekyll-gitbook

License: Apache License 2.0

HTML 26.76% Smarty 3.26% JavaScript 31.31% CSS 38.49% Ruby 0.18%
jekyll-theme gitbook jekyll-themes github-page theme html jekyll-gitbook

jekyll-gitbook's Introduction

layout title permalink
home
Jekyll Gitbook Theme
/

Make Jelly site have a GitBook look!

Demo

Live demo on Github Pages: https://sighingnow.github.io/jekyll-gitbook

Jekyll Themes

Why Jekyll with GitBook

GitBook is an amazing frontend style to present and organize contents (such as book chapters and blogs) on Web. The typical to deploy GitBook at Github Pages is building HTML files locally and then push to Github repository, usually to the gh-pages branch. It's quite annoying to repeat such workload and make it hard for people do version control via git for when there are generated HTML files to be staged in and out.

This theme takes style definition out of generated GitBook site and provided the template for Jekyll to rendering markdown documents to HTML, thus the whole site can be deployed to Github Pages without generating and uploading HTML bundle every time when there are changes to the original repo.

How to Get Started

This theme can be used just as other Jekyll themes and support remote theme, see the official guide as well.

You can introduce this jekyll theme into your own site by either

  • Fork this repository and add your markdown posts to the _posts folder.
  • Use as a remote theme in your _config.yml(just like what we do for this site itself),
remote_theme: sighingnow/jekyll-gitbook

Deploy Locally with Jekyll Serve

This theme can be ran locally using Ruby and Gemfiles.

Testing your GitHub Pages site locally with Jekyll - GitHub

Full-text search

The search functionality in jekyll-gitbook theme is powered by the gitbook-plugin-search-pro plugin and is enabled by default.

https://sighingnow.github.io/jekyll-gitbook/?q=generated

Code highlight

The code highlight style is configurable the following entry in _config.yaml:

syntax_highlighter_style: colorful

The default code highlight style is colorful, the full supported styles can be found from the rouge repository. Customized style can be added to ./assets/gitbook/rouge/.

How to generate TOC

The jekyll-gitbook theme leverages jekyll-toc to generate the Contents for the page. The TOC feature is not enabled by default. To use the TOC feature, modify the TOC configuration in _config.yml:

toc:
    enabled: true
    h_min: 1
    h_max: 3

Google Analytics, etc.

The jekyll-gitboook theme supports embedding the Google Analytics, CNZZ and Application Insights website analytical tools with the following minimal configuration in _config.yaml:

tracker:
  google_analytics: "<YOUR GOOGLE ANALYTICS KEY, e.g, UA-xxxxxx-x>"

Similarly, CNZZ can be added with the following configuration in _config.yaml

tracker:
  cnzz: "<YOUR CNZZ ANALYTICS KEY, e.g., xxxxxxxx>"

Application Insights can be added with the following configuration in _config.yaml

tracker:
  application_insights: "<YOUR APPLICATION INSIGHTS CONNECTION STRING>"

Disqus comments

Disqus comments can be enabled by adding the following configuration in _config.yaml:

disqushandler: "<YOUR DISQUS SHORTNAME>"

Jekyll collections

Jekyll's collections is supported to organize the pages in a more fine-grained manner, e.g.,

collections:
  pages:
    output: true
    sort_by: date
    permalink: /:collection/:year-:month-:day-:title:output_ext

Extra StyleSheet or Javascript elements

You can add extra CSS or JavaScript references using configuration collections:

  • extra_css: for additional style sheets. If the url does not start by http, the path must be relative to the root of the site, without a starting /.
  • extra_header_js: for additional scripts to be included in the <head> tag, after the extra_css has been added. If the url does not start by http, the path must be relative to the root of the site, without a starting /.
  • extra_footer_js: for additional scripts to be included at the end of the HTML document, just before the site tracking script. If the url does not start by http, the path must be relative to the root of the site, without a starting /.

Customizing font settings

The fonts can be customized by modifying the .book.font-family-0 and .book.font-family-1 entry in ./assets/gitbook/custom.css,

.book.font-family-0 {
    font-family: Georgia, serif;
}
.book.font-family-1 {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

Tips, Warnings and Dangers blocks

The jekyll-gitbook theme supports customized kramdown attributes ({: .block-tip }, {: .block-warning }, {: .block-danger }) like that displayed in the discord.js website. The marker can be used like

> ##### TIP
>
> This guide is last tested with @napi-rs/canvas^0.1.20, so make sure you have
> this or a similar version after installation.
{: .block-tip }

Rendered page can be previewed from

https://sighingnow.github.io/jekyll-gitbook/jekyll/2022-06-30-tips_warnings_dangers.html

Cover image inside pages

The jekyll-gitbook theme supports adding a cover image to a specific page by adding a cover field to the page metadata:

  ---
  title: Page with cover image
  author: Tao He
  date: 2022-05-24
  category: Jekyll
  layout: post
+ cover: /assets/jekyll-gitbook/dinosaur.gif
  ---

The effect can be previewed from

https://sighingnow.github.io/jekyll-gitbook/jekyll/2022-05-24-page_cover.html

Diagrams with mermaid.js

This jekyll-theme supports mermaid.js to render diagrams in markdown.

To enable the mermaid support, you need to set mermaid: true in the front matter of your post.

---
mermaid: true
---

The example can be previewed from

https://sighingnow.github.io/jekyll-gitbook/jekyll/2023-08-31-mermaid.html

License

This work is open sourced under the Apache License, Version 2.0.

Copyright 2019 Tao He.

jekyll-gitbook's People

Contributors

chandlermccowan avatar happypig375 avatar jsksxs360 avatar lingrenkong avatar marc-portier avatar odeatavanade avatar sighingnow 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

jekyll-gitbook's Issues

Chinese search & night mode display

  1. Can the search box support Chinese search?

  2. If the markdown file contains syntax highlighting, it will be difficult to distinguish the background color from some code color when night mode is turned on.

  • e.g. [ & ] in if [ -n "$a" ]

Sent from PPHub

horizontally scrollable header on mobile webkit when side menu open

Thank you so much for addressing the formatting that led me to this! 🙏 Here is yet another strange mobile webkit-exclusive thing that I randomly discovered when viewing the theme in Safari. With side menu open the header is interpreted as a horizontally scrollable field allowing for a little bit of wobble.

scrollable.header.mp4

I apologize for keeping reporting such petty things.

Sharing button bug

I want to change the share links in the top right corner to my GitHub repository address and telegram group address.

A separate _includes/gitbook-sharing.json.tpl has been added to tweak the gitbook sharing plugin configuration. You could update the "github" and "github_link" entries for github, and "telegram" and "telegram_link" for telegram, respectively.

(You can has a customized _includes/gitbook-sharing.json.tpl under your own project root directory to overwrite the default configuration.)

I tried, but it failed. Would you check for me?

It looks like something went wrong.

  • image

Originally posted by @Oreomeow in #45 (comment)

Prev Next page inversed for pages.

Bug report

First thanks for sharing this great theme 👍

Problem definition

The < and > buttons in the left and right side of the page drive the reader in the reverse order for pages.

How to reproduce

  1. Go to the first page in the menu for the demo site here
  2. Notice it will only show the arrow for the "Previous page" while this is the first page
  3. Go to any other page in the menu and use the "Previous/Next page" arrows, Next link to the Prev page in the menu

Expected

Starting in the main page using next will move to the next item in the left menu, first pages then posts.

Notes

It works OK for posts.

Start and 404 page bug.

Hello,

i made a fork and tried it. I think I found a little bug. I attached the pictures. Appears on start page and page 404 only.

local_start
sample_start
sample_404

I think the bug to include search.html twice in the home layout. If I toggle line comment, it works fine.

twice_include_search_html

Tamas

Toc on mobile not work

I noticed that when I want to go to a h1—h4 title, the navigation bar closes instead of going to the desired section.

This only happens on titles within the same ".md" document, if I want to go to another document it works perfectly.

Doc about social media icons

Will be great to add info about the social media icons. I did a microsite and I want to personalize the facebook and twitter but I only found references to facebook in the plugin code and I could modify them but clearly not a proper solution.

Probably good idea to do it via data using yaml to be capable to customize enable or disable those icons.

Two requests

In remote_theme mode

  • I want to change the share links in the top right corner to my GitHub repository address and telegram group address.
  • I want to modify the favicon.ico.

Is this feasible? I look forward to your reply.

Support mermaid

Thanks for your work.
Do you have any plans to support rendering for mermaid?

MD tables only shows a small part in portrait mode on mobile devices

simple test data

|title1|title2|title3|title4|title5|title6|title7|title8|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|1|2|3|4|5|6|7|8|
|1|2|3|4|5|6|7|8|
|1|2|3|4|5|6|7|8|
|1|2|3|4|5|6|7|8|

and there is no scrollbars for the viewer
msedge_JcxoD6uODW

update

got an alternative solution to show a scrollbar when writting MD
https://stackoverflow.com/questions/41076390/is-there-a-way-to-overflow-a-markdown-table-using-html

<div class="table-wrapper" markdown="block">
*TABLE CONTENT*
</div>

css add:

.table-wrapper {
  overflow-x: scroll;
}

Potentially Unintended Mobile Behavior

Hi! I'm loving the theme and want to use it for a book-style website, but I ran into one(-ish) weirdness. The desktop version is borderline perfect, but I have a few questions regarding the header buttons' behavior in mobile mode. I understand why this happens, and that this is completely tied to the width of the window (it only happens in portrait mode), but I lack brains to solve it myself.

Can these buttons become hidden on mobile when the left-side menu is open?
mobile-header-buttons-problem

With menu open they don't have much functionality in portrait mode anyway, because of things like this:
mobile-header-buttons-useless-1
mobile-header-buttons-useless-2

A whole other part of the problem is that the buttons become glued to the top of the window, along with the menu button, so you can't close the menu unless you scroll all the way up or tap on a chapter (this also happens on desktop if the window is made very narrow):
https://user-images.githubusercontent.com/60663493/207224503-b4014dc2-d33a-44cd-97d5-53e4cd5b2a08.mp4

Can the menu button (or all of them, for that matter) be unglued from the top in mobile/narrow window with the menu open (when the header collapses and the buttons align vertically)?

Sorry for rolling two issues into one, but I recognize that these can be considered extremely pedantic non-problems, so please consider this posting a question rather than a bug report.

Footnotes not linking

Hello there!
I have a question hoping for help! Any pointers are immensely appreciated! Thank you very much!
The footnotes on my page refuse to go to the appropriate place at the bottom of the page. I really cannot figure out what is preventing it so. https://offingbloom.com/ob-v1/2023-07-16-prologue.html
The footnote appears to be written correctly as such:
Tanhua1
But it doesn't scroll on the website. I am not quite sure this is.

Thank you kindly for your time!

Query problem

If I jump to a page and query the information of this page, click the link, it will suddenly jump, and then immediately jump back to the query page, I don't know if it is my certain configuration problem

20220506143345

snippet of code in html 'details' tag

I'd like to insert code into my details html tag :

blah ``` ls -al ```

But the theme does not interpret the code snippet into my detail tag.

Any idea ?

pages load pre-scrolled on mobile webkit

I am absolutely in love with this theme and super grateful for its existence, and maybe I just care too much about inconsequential stuff, but I have discovered yet another strange "problem" on mobile. It seems that in Chromium-based mobile browsers gitbook pages have a tendency to load slightly pre-scrolled (initially discovered in Safari on gf's iphone and then confirmed in Chrome on both iOS and Android). Only happens on a fresh load or a page refresh: if you go to a different page via the side menu, it will open properly, and all the other pages of the website from that point on will load as expected too, but if you then refresh the page, it will load slightly pre-scrolled again. I tried tinkering with parts of the code that mention webkit, but couldn't identify the root of this behavior.

prescrolled-1
prescrolled-2
prescrolled-3

prescrolled.mp4

could gitbook-theme support comments?

thank you all guys for this great theme. I like it very much. It's very clean.

but I'd like to have a comments function for this theme, I also searched for gitalk for comments.
Do you know how to integrate with this theme?

Directory automatic sorting

I have added several md files under the _pages folder with names 01, 02, 03, but the order of the directories displayed on the generated webpage is not 123, but 321 in reverse order, how do I change it? Can they be sorted numerically from smallest to largest?

feature: easy allow extra level of `custom.css` in remote usage context

The theme currently uses a custom.css (in assests/gitbook/) for special local settings.

However if people use the theme in a jekyll-remote-theme setting this obliges them to copy and extend the file in order to add own extra entries.

i would like to suggest

  • introduce an extra custom-local.css that is just empty (apart from a comment declaring its intent)
  • that is imported at the end of custom.css
  • that can then safely be filled in locally to add extra useful style rules...

if you like this idea, I will gladly work up the PR

Dark Theme

Sorry if this is a stupid question, but I can't find a way to apply a dark theme. Is there one?

How to make the search button work?

Thank you for contributing this excellent theme. I really like it. I guess it could support the search function using lunr. But I am not familiar with the code. Would you mind share your opinion about how to make the search function work within this theme? Thank you!

Secure up the `book-header`

Is it possible to freeze the position of panel book-header so that page scrolling doesn't affect it?

Screenshot_2022-03-25-18-25-00

For articles the button back-to-top is suitable, but not for documentation. In addition active partition is highlighted in the menu.

Thanks for the minimalistic template!

Why date is required in post name?

Hi, why is the date needed as part of the post name? How can I disable that option in the theme

e.g.

2023-05-24-example.md - is published on gh-page

01-first-chapter.md - isn't published on gh-page

How can I add more catagory?

Hello, just need some help after successfully deploy this blog on my account.
I want to add two more category like cpp and python, how should I modify the code?

Add pages not shown on TOC

Hello there, how can I add a page (searchable or linkable in site) that doesn't show up on the Toc? I tried to add a page as a link to the bottom of the toc footer using the post/home layouts, but they would show up was 404. If I need to make a new layout for these pages,how can I do this, and where do I change on the new layout html? Thank you so much for your time and help!

Is it possible to use this theme without forking, with with a `docs` folder and `_config.yml` file?

The README instructions indicate to use the theme we have to fork the repo.

GitHub pages also provide the positivily to throw a bunch of markdown files and a _config.yml file into a docs folder.
I tried that in this repo but it doesn't seem to work well? microbit-carlos/microbit-bird-activity@76ee1b5
It fails to load these assets:

Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/gitbook.js”. [microbit-bird-activity:222:1](https://microbit-carlos.github.io/microbit-bird-activity/)
Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/theme.js”. [microbit-bird-activity:223:1](https://microbit-carlos.github.io/microbit-bird-activity/)
Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/gitbook-plugin-fontsettings/fontsettings.js”. [microbit-bird-activity:225:1](https://microbit-carlos.github.io/microbit-bird-activity/)
Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/gitbook-plugin-sharing/buttons.js”. [microbit-bird-activity:226:1](https://microbit-carlos.github.io/microbit-bird-activity/)
Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/gitbook-plugin-search-pro/jquery.mark.min.js”. [microbit-bird-activity:233:1](https://microbit-carlos.github.io/microbit-bird-activity/)
Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/gitbook-plugin-search-pro/search.js”. [microbit-bird-activity:234:1](https://microbit-carlos.github.io/microbit-bird-activity/)
Loading failed for the <script> with source “https://microbit-carlos.github.io/microbit-bird-activity/gitbook/gitbook-plugin-back-to-top-button/plugin.js”.

Is this method of using the theme supported?

A quick return to top button

Thanks for adding the search plugin!
Would it be possible to add a quick return to top button? When an article is too long, I add a table of contents with jumpable links at the top and when I get very far down the article, I would like to be able to quickly return to the top table of contents.

Date issue

I changed the post of 2019-04-28 to 2022-08-14, but it seems to have disappeared. I have tried to reload the site several times, but no posts have been returned. I checked that the date is set as a variable in the code, what's the problem? The same goes for all the other posts.

[Feature request] Support the display of multi-level directories

Describe

I had multi-level directories, as follow:

_posts
├── 2023-08-01-labelimg_to_yolov5.md
├── test-demo1
│   └── 2023-09-01-test1.md
└── test-demo2
    └── 2023-09-01-test2.md

When I used the jekyll-gitbook, the sidebar only displays test1 and test2, as like:
image

Expectation

image

Usage instruction

There's no Gemfile in this theme's repo. How does one setup this theme into a jekyll site?

bug: book.with-summary is fighting with the drop-down menus

as a side effect of looking to #73 I noticed that he drop down menus (on the left for font + background, on the right for sharing) do not work if the summary-side bar is active.

I see the style-effects are still correctly applied (the .open class is added to the correct div.dropdown) but somehow that does not make the menus actually pop up.

I assume (for now) there is a conflict between the book.with-summary leading to left: 0 applied on a higher level. Would need more investigation, but wanted to share already in case somebody has a quicker eye on this.

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.