├── _includes ├── above-content.html ├── below-content.html ├── footer-extra.html ├── head-extra.html ├── chapter-iterate-init.html ├── chapter-iterate-next.html ├── chapter-link.html ├── google-analytics.html ├── figure.html ├── metadata-post.json.tpl ├── gitbook-sharing.json.tpl ├── metadata-home.json.tpl ├── body.html ├── footer.html ├── gitbook-metadata.json.tpl ├── chapterbook-toc.html ├── metadata.json.tpl ├── toc-date.html ├── head.html ├── build-chapter-nav.html ├── chapter-iterate-current.html ├── chapter-vars.html └── toc.html ├── sitemap.txt ├── .gitignore ├── assets ├── gitbook │ ├── rouge │ │ ├── igor_pro.css │ │ ├── monokai_sublime.css │ │ ├── bw.css │ │ ├── base16.css │ │ ├── gruvbox.css │ │ ├── pastie.css │ │ ├── colorful.css │ │ ├── tulip.css │ │ ├── magritte.css │ │ ├── thankful_eyes.css │ │ ├── molokai.css │ │ ├── github.css │ │ └── monokai.css │ ├── images │ │ ├── favicon.ico │ │ └── apple-touch-icon-precomposed-152.png │ ├── fonts │ │ └── fontawesome │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ ├── gitbook-plugin-chapter-fold │ │ ├── chapter-fold.css │ │ └── chapter-fold.js │ ├── gitbook-plugin-search │ │ ├── search.css │ │ ├── search-engine.js │ │ └── search.js │ ├── gitbook-plugin-back-to-top-button │ │ ├── plugin.js │ │ └── plugin.css │ ├── gitbook-plugin-search-pro │ │ ├── search.css │ │ ├── search.js │ │ └── jquery.mark.min.js │ ├── gitbook-plugin-lunr │ │ └── search-lunr.js │ ├── gitbook-plugin-sharing │ │ └── buttons.js │ ├── custom.css │ └── gitbook-plugin-fontsettings │ │ ├── fontsettings.js │ │ └── website.css ├── demo │ ├── jekyll-chapterbook-thumbnail.png │ └── C-maj.svg └── chapterbook │ └── chapterbook.js ├── _layouts ├── post.html ├── home.html ├── part.html ├── page.html ├── sitemap.html ├── default.html └── chapter.html ├── _chapters ├── 020-dummy-chapters │ ├── 000-index.md │ ├── 005.draft-example-draft.md │ ├── 010-lorem.md │ ├── 020-neque.md │ └── 020-dolor.md ├── 010-chapterbook-theme │ ├── 000-index.md │ ├── 010-getting-started.md │ ├── 050-wide-tables.md │ ├── 060-variables.md │ └── 020-helpers.md ├── 000-front │ ├── 020-contents.md │ ├── 030.draft-introduction.md │ └── 010-title.md └── 999-back │ └── 010-references.md ├── _pages ├── privacy.md └── draft-outline.md ├── _posts └── 2023-02-20-initial-release.md ├── Gemfile ├── 404.html ├── _config.yml └── LICENSE /_includes/above-content.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_includes/below-content.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_includes/footer-extra.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_includes/head-extra.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sitemap.txt: -------------------------------------------------------------------------------- 1 | --- 2 | layout: sitemap 3 | --- -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _site/ 2 | _draft/ 3 | .jekyll-cache/ 4 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/igor_pro.css: -------------------------------------------------------------------------------- 1 | unknown theme: igor_pro 2 | -------------------------------------------------------------------------------- /_layouts/post.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | --- 4 | 5 | {{ content }} -------------------------------------------------------------------------------- /_layouts/home.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | --- 4 | 5 | {{ content }} 6 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/monokai_sublime.css: -------------------------------------------------------------------------------- 1 | unknown theme: monokai_sublime 2 | -------------------------------------------------------------------------------- /_chapters/020-dummy-chapters/000-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: dummies 3 | layout: part 4 | --- 5 | -------------------------------------------------------------------------------- /_chapters/010-chapterbook-theme/000-index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: part 3 | slug: theme 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /assets/gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /assets/demo/jekyll-chapterbook-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/demo/jekyll-chapterbook-thumbnail.png -------------------------------------------------------------------------------- /assets/gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /assets/gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /assets/gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /assets/gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /assets/gitbook/fonts/fontawesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /assets/gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jasongrimes/jekyll-chapterbook/HEAD/assets/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /_includes/chapter-iterate-init.html: -------------------------------------------------------------------------------- 1 | {% include chapter-iterate-vars.html unset="all-iterators" %} 2 | 3 | {% assign i_chapter_idx = 0 %} 4 | 5 | {% include chapter-iterate-current.html %} 6 | 7 | -------------------------------------------------------------------------------- /_includes/chapter-iterate-next.html: -------------------------------------------------------------------------------- 1 | {% include chapter-iterate-vars.html set="prev" %} 2 | 3 | {% assign i_chapter_idx = i_chapter_idx | plus: 1 %} 4 | 5 | {% include chapter-iterate-current.html %} 6 | 7 | 8 | -------------------------------------------------------------------------------- /_pages/privacy.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Privacy statement 3 | permalink: /privacy 4 | layout: page 5 | --- 6 | 7 | Example privacy page. 8 | 9 | --- 10 | ``` 11 | This file is located at: {{ page.path }} 12 | ``` 13 | --- 14 | -------------------------------------------------------------------------------- /_posts/2023-02-20-initial-release.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Initial release 3 | author: Jason Grimes 4 | date: 2023-02-20 5 | layout: post 6 | --- 7 | 8 | Initial public release of [jekyll-chapterbook](https://github.com/jasongrimes/jekyll-chapterbook). -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } 6 | gem "jekyll" 7 | gem 'jekyll-feed' 8 | gem 'jekyll-readme-index' 9 | gem 'jemoji' 10 | gem 'webrick' 11 | 12 | # gem "rails" 13 | -------------------------------------------------------------------------------- /_includes/chapter-link.html: -------------------------------------------------------------------------------- 1 | {%- capture _linklabel -%} 2 | {% include chapter-vars.html slug=include.slug withnum="chapter" %} 3 | {%- endcapture -%}{% if chapter_num %}Chapter {{ chapter_num }}. {% endif %}{{ chapter.title | escape }} -------------------------------------------------------------------------------- /_chapters/000-front/020-contents.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Table of Contents 3 | slug: contents 4 | --- 5 | 6 | *Also see the [outline](outline) of the entire book as planned, including draft chapters that are not yet completed.* 7 | 8 | {% include chapterbook-toc.html %} 9 | 10 | --- 11 | ``` 12 | This file is located at: {{ page.path }} 13 | ``` 14 | --- 15 | -------------------------------------------------------------------------------- /_layouts/part.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: chapter 3 | --- 4 | 5 |
6 |
7 | {{ content }} 8 |
9 | 10 | {% include chapter-vars.html id=page.id %} 11 | 12 | {% if part_folder %} 13 | {% include chapterbook-toc.html part=part_folder %} 14 | {% endif %} 15 |
16 | 17 | -------------------------------------------------------------------------------- /_chapters/000-front/030.draft-introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction 3 | slug: introduction 4 | abstract: An example "draft" chapter. 5 | --- 6 | 7 | Introductory chapter 8 | to be written later. 9 | 10 | See {% include chapter-link.html slug="draft" %} for more information. 11 | 12 | --- 13 | ``` 14 | This file is located at: {{ page.path }} 15 | ``` 16 | --- -------------------------------------------------------------------------------- /_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | {% if page.title %} 6 |

{{ page.title | escape }}

7 | {% endif %} 8 | {% if page.subtitle %} 9 |
{{ page.subtitle | escape }}
10 | {% endif %} 11 | 12 |
13 | {{ content }} 14 |
15 | -------------------------------------------------------------------------------- /_includes/google-analytics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /_chapters/010-chapterbook-theme/010-getting-started.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Getting started 3 | slug: getting-started 4 | abstract: A guide to quickly setting up your site with this theme. 5 | --- 6 | 7 | This is an example chapter page. 8 | 9 | [Learn more about getting started with this theme.]({{ site.baseurl }}/index.html#getting-started) 10 | 11 | --- 12 | ``` 13 | This file is located at: {{ page.path }} 14 | ``` 15 | --- 16 | 17 | -------------------------------------------------------------------------------- /_pages/draft-outline.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Draft outline 3 | permalink: /outline 4 | layout: page 5 | --- 6 | 7 | An outline of the chapters planned for this book. 8 | Many of them have yet to be written. 9 | Only the chapters with a checkmark appear in the contents and navigation. 10 | 11 | {% include chapterbook-toc.html show_drafts=true %} 12 | 13 | 14 | --- 15 | ``` 16 | This file is located at: {{ page.path }} 17 | ``` 18 | --- 19 | -------------------------------------------------------------------------------- /_includes/figure.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | {{ include.caption }} 4 | 5 |
{{ include.caption }}
6 |
-------------------------------------------------------------------------------- /_layouts/sitemap.html: -------------------------------------------------------------------------------- 1 | {% for pg in site.chapters -%} 2 | {%- capture url -%}{% include chapter-vars.html id=pg.id %}{% unless chapter_is_draft %}{{- site.baseurl_canonical | default: site.url }}{{ pg.url -}}{% endunless %}{%- endcapture %} 3 | {%- capture sitemap_url %}{{ url|strip }}{% endcapture -%} 4 | {%- if sitemap_url.size > 0 %}{{ sitemap_url }} 5 | {% endif %} 6 | {%- endfor %} 7 | {%- for pg in site.pages %} 8 | {{- site.baseurl_canonical | default: site.url }}{{ pg.url }} 9 | {% endfor %} -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | --- 4 | 5 | 18 | 19 |
20 |

404

21 | 22 |

Page not found :(

23 |

The requested page could not be found.

24 |
25 | -------------------------------------------------------------------------------- /_includes/metadata-post.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "page": { 3 | "title": "Introduction", 4 | "level": "1.1", 5 | "depth": 1, 6 | {% if page.next %} 7 | "next": { 8 | "title": "{{page.next.title}}", 9 | "level": "1.2", 10 | "depth": 1, 11 | "path": "{{page.next.path}}", 12 | "ref": "{{page.next.path}}", 13 | "articles": [] 14 | }, 15 | {% endif %} 16 | "dir": "ltr" 17 | }, 18 | 19 | {%- include metadata.json.tpl -%} 20 | } -------------------------------------------------------------------------------- /_includes/gitbook-sharing.json.tpl: -------------------------------------------------------------------------------- 1 | "sharing": { 2 | "all": ["facebook", "google", "twitter", "weibo", "instapaper", "github", "telegram"], 3 | "facebook": true, 4 | "google": false, 5 | "github": true, 6 | "github_link": "https://github.com", 7 | "telegram": false, 8 | "telegram_link": "https://t.me", 9 | "instapaper": false, 10 | "twitter": true, 11 | "vk": false, 12 | "weibo": false 13 | }, 14 | -------------------------------------------------------------------------------- /_chapters/000-front/010-title.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: book 3 | title: Demo Book 4 | abstract: An example book for showcasing the Jekyll Chapterbook theme. 5 | --- 6 | 7 | By Jason Grimes 8 | 9 | Copyright © {{"now" | date: "%Y"}} by {{site.author}}. 10 | 11 | Last updated: {{ "now" | date: "%B %e, %Y" }} 12 | 13 | {% if site.baseurl_canonical %} 14 | The latest version of this book can always be found at 15 | {{site.baseurl_canonical}}{{page.url}}. 16 | {% endif %} 17 | 18 | --- 19 | ``` 20 | This file is located at: {{ page.path }} 21 | ``` 22 | --- 23 | -------------------------------------------------------------------------------- /_includes/metadata-home.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "page": { 3 | "title": "Introduction", 4 | "level": "1.1", 5 | "depth": 1, 6 | {% assign reversed_posts = site.posts | reverse %} 7 | 8 | {% if reversed_posts %} 9 | "next": { 10 | "title": "{{reversed_posts.first.title}}", 11 | "level": "1.2", 12 | "depth": 1, 13 | "path": "{{reversed_posts.first.path}}", 14 | "ref": "{{reversed_posts.first.path}}", 15 | "articles": [] 16 | }, 17 | {% endif %} 18 | "dir": "ltr" 19 | }, 20 | 21 | {%- include metadata.json.tpl -%} 22 | } -------------------------------------------------------------------------------- /assets/chapterbook/chapterbook.js: -------------------------------------------------------------------------------- 1 | 2 | $(function() { 3 | /* 4 | $('.book').on('click', '.btn-close-sidebar', function() { 5 | $('.book').removeClass('with-summary'); 6 | }); 7 | $('.book').on('click', '.btn-open-sidebar', function() { 8 | $('.book').addClass('with-summary'); 9 | }); 10 | $('.book').on('click', '.btn-toggle-sidebar', function() { 11 | $('.book').toggleClass('with-summary'); 12 | }); 13 | */ 14 | // Close sidebar when clicking outside of it on mobile. 15 | $('body').on('click', '.book.with-summary .body-inner, .book.with-summary .page-footer', function() { 16 | if ($(document).width() <= 600) { 17 | $('.book').removeClass('with-summary'); 18 | } 19 | 20 | }); 21 | }); -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-chapter-fold/chapter-fold.css: -------------------------------------------------------------------------------- 1 | .book .book-summary .chapter > .articles { 2 | overflow: hidden; 3 | max-height: 0px; 4 | } 5 | 6 | .book .book-summary .chapter.expanded > .articles { 7 | max-height: 9999px; 8 | } 9 | 10 | .book .book-summary .exc-trigger { 11 | position: absolute; 12 | left: 12px; 13 | top: 12px; 14 | } 15 | 16 | .book .book-summary ul.summary li a, 17 | .book .book-summary ul.summary li span { 18 | padding-left: 30px; 19 | } 20 | 21 | .book .book-summary .exc-trigger:before { 22 | content: "\f105"; 23 | } 24 | 25 | .book .book-summary .expanded > a .exc-trigger:before, 26 | .book .book-summary .expanded > span .exc-trigger:before { 27 | content: "\f107"; 28 | } 29 | -------------------------------------------------------------------------------- /_includes/body.html: -------------------------------------------------------------------------------- 1 |
2 | {% if page.cover %} 3 | {{ page.title | escape }} 9 | {% endif %} 10 | 11 |
12 |
13 |
14 |
15 | {% if page.title %} 16 |

{{ page.title | escape }}

17 | {% else %} 18 |

{{ site.title | escape }}

19 | {% endif %} 20 | 21 | {{ content }} 22 |
23 |
24 | 25 | {%- include search.html -%} 26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-search/search.css: -------------------------------------------------------------------------------- 1 | /* 2 | This CSS only styled the search results section, not the search input 3 | It defines the basic interraction to hide content when displaying results, etc 4 | */ 5 | #book-search-results .search-results { 6 | display: none; 7 | } 8 | #book-search-results .search-results ul.search-results-list { 9 | list-style-type: none; 10 | padding-left: 0; 11 | } 12 | #book-search-results .search-results ul.search-results-list li { 13 | margin-bottom: 1.5rem; 14 | padding-bottom: 0.5rem; 15 | /* Highlight results */ 16 | } 17 | #book-search-results .search-results ul.search-results-list li p em { 18 | background-color: rgba(255, 220, 0, 0.4); 19 | font-style: normal; 20 | } 21 | #book-search-results .search-results .no-results { 22 | display: none; 23 | } 24 | #book-search-results.open .search-results { 25 | display: block; 26 | } 27 | #book-search-results.open .search-noresults { 28 | display: none; 29 | } 30 | #book-search-results.no-results .search-results .has-results { 31 | display: none; 32 | } 33 | #book-search-results.no-results .search-results .no-results { 34 | display: block; 35 | } 36 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-back-to-top-button/plugin.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | gitbook.events.on('page.change', function() { 6 | var back_to_top_button = ['
'].join(""); 7 | $(".page-wrapper").append(back_to_top_button) 8 | 9 | $(".back-to-top").hide(); 10 | 11 | $(".back-to-top").hover(function() { 12 | $(this).css('cursor', 'pointer').attr('title', 'Back to top'); 13 | }, function() { 14 | $(this).css('cursor', 'auto'); 15 | }); 16 | 17 | $('.book-body,.body-inner,.page-wrapper').on('scroll', function () { 18 | if ($(this).scrollTop() > 100) { 19 | $('.back-to-top').fadeIn(); 20 | } else { 21 | $('.back-to-top').fadeOut(); 22 | } 23 | }); 24 | 25 | $('.back-to-top').on('click', function () { 26 | $('.book-body,.body-inner').animate({ 27 | scrollTop: 0 28 | }, 800); 29 | return false; 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /_chapters/020-dummy-chapters/005.draft-example-draft.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Example draft chapter 3 | slug: draft 4 | abstract: An example of a "draft" chapter, hidden from the ToC but visible in the outline. 5 | --- 6 | 7 | A chapter can be marked as a "draft" by renaming the file and adding `.draft` to the numeric prefix, like this: 8 | 9 | 010.draft-introduction.md 10 | 11 | Draft chapters are not listed in the table of contents, 12 | and they are not included in the chapter numberings. 13 | (To see in your dev environment how all the drafts _would_ be numbered if they weren't drafts, 14 | set `show_drafts_in_dev: true` in [_config.yml](https://github.com/jasongrimes/jekyll-chapterbook/blob/master/_config.yml).) 15 | 16 | But drafts _are_ listed in the book [outline](/outline.html). 17 | This enables a workflow in which you start with an outline of your book, 18 | made with empty draft chapters having just a `title` and maybe an `abstract`, 19 | ordered and grouped into parts as needed (and frequently reorganized). 20 | 21 | Then you can flesh out the chapters over time, 22 | and when ready, 23 | remove the `.draft` from the file name so it appears in the book. 24 | 25 | 26 | --- 27 | ``` 28 | This file is located at: {{ page.path }} 29 | ``` 30 | --- 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-search-pro/search.css: -------------------------------------------------------------------------------- 1 | /* 2 | This CSS only styled the search results section, not the search input 3 | It defines the basic interraction to hide content when displaying results, etc 4 | */ 5 | #book-search-input { 6 | background: inherit; 7 | } 8 | #book-search-results .search-results { 9 | display: none; 10 | } 11 | #book-search-results .search-results ul.search-results-list { 12 | list-style-type: none; 13 | padding-left: 0; 14 | } 15 | #book-search-results .search-results ul.search-results-list li { 16 | margin-bottom: 1.5rem; 17 | padding-bottom: 0.5rem; 18 | /* Highlight results */ 19 | } 20 | #book-search-results .search-results ul.search-results-list li p em { 21 | background-color: rgba(255, 220, 0, 0.4); 22 | font-style: normal; 23 | } 24 | #book-search-results .search-results .no-results { 25 | display: none; 26 | } 27 | #book-search-results.open .search-results { 28 | display: block; 29 | } 30 | #book-search-results.open .search-noresults { 31 | display: none; 32 | } 33 | #book-search-results.no-results .search-results .has-results { 34 | display: none; 35 | } 36 | #book-search-results.no-results .search-results .no-results { 37 | display: block; 38 | } 39 | #book-search-results span.search-highlight-keyword { 40 | background: #ff0; 41 | } 42 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-search/search-engine.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Global search objects 6 | var engine = null; 7 | var initialized = false; 8 | 9 | // Set a new search engine 10 | function setEngine(Engine, config) { 11 | initialized = false; 12 | engine = new Engine(config); 13 | 14 | init(config); 15 | } 16 | 17 | // Initialize search engine with config 18 | function init(config) { 19 | if (!engine) throw new Error('No engine set for research. Set an engine using gitbook.research.setEngine(Engine).'); 20 | 21 | return engine.init(config) 22 | .then(function() { 23 | initialized = true; 24 | gitbook.events.trigger('search.ready'); 25 | }); 26 | } 27 | 28 | // Launch search for query q 29 | function query(q, offset, length) { 30 | if (!initialized) throw new Error('Search has not been initialized'); 31 | return engine.search(q, offset, length); 32 | } 33 | 34 | // Get stats about search 35 | function getEngine() { 36 | return engine? engine.name : null; 37 | } 38 | 39 | function isInitialized() { 40 | return initialized; 41 | } 42 | 43 | // Initialize gitbook.search 44 | gitbook.search = { 45 | setEngine: setEngine, 46 | getEngine: getEngine, 47 | query: query, 48 | isInitialized: isInitialized 49 | }; 50 | }); -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-back-to-top-button/plugin.css: -------------------------------------------------------------------------------- 1 | .back-to-top { 2 | position: fixed; 3 | bottom: 25px; 4 | right: calc((100% - 300px - min(100% - 300px, 800px)) / 2 + 25px); 5 | background: rgba(0, 0, 0, 0.5); 6 | width: 50px; 7 | height: 50px; 8 | display: block; 9 | text-decoration: none; 10 | -webkit-border-radius: 35px; 11 | -moz-border-radius: 35px; 12 | border-radius: 35px; 13 | display: none; 14 | } 15 | .back-to-top i { 16 | color: #fff; 17 | margin: 0; 18 | position: relative; 19 | left: 15px; 20 | top: 14px; 21 | font-size: 22px; 22 | } 23 | .back-to-top:hover { 24 | background: rgba(0, 0, 0, 0.9); 25 | cursor: pointer; 26 | } 27 | .book.color-theme-1 .back-to-top { 28 | background: rgba(112, 66, 20, 0.5); 29 | } 30 | .book.color-theme-1 .back-to-top i { 31 | color: #f3eacb; 32 | } 33 | .book.color-theme-1 .back-to-top:hover { 34 | background: rgba(112, 66, 20, 0.9); 35 | } 36 | .book.color-theme-2 .back-to-top { 37 | background: rgba(189, 202, 219, 0.5); 38 | } 39 | .book.color-theme-2 .back-to-top i { 40 | color: #1C1F2B; 41 | } 42 | .book.color-theme-2 .back-to-top:hover { 43 | background: rgba(189, 202, 219, 0.9); 44 | } 45 | 46 | @media only screen 47 | and (min-device-width: 320px) 48 | and (max-device-width: 480px) 49 | and (-webkit-min-device-pixel-ratio: 2) 50 | and (orientation: portrait) { 51 | .back-to-top { 52 | bottom: 10px; 53 | right: 10px; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/bw.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight, .highlight .w { 4 | color: #000000; 5 | background-color: #ffffff; 6 | } 7 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs { 8 | font-style: italic; 9 | } 10 | .highlight .cp { 11 | } 12 | .highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kv { 13 | font-weight: bold; 14 | } 15 | .highlight .kp { 16 | } 17 | .highlight .kt { 18 | } 19 | .highlight .o, .highlight .ow { 20 | font-weight: bold; 21 | } 22 | .highlight .nc { 23 | font-weight: bold; 24 | } 25 | .highlight .nn { 26 | font-weight: bold; 27 | } 28 | .highlight .ne { 29 | font-weight: bold; 30 | } 31 | .highlight .ni { 32 | font-weight: bold; 33 | } 34 | .highlight .nt { 35 | font-weight: bold; 36 | } 37 | .highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .sr, .highlight .s1, .highlight .ss { 38 | font-style: italic; 39 | } 40 | .highlight .sa { 41 | font-weight: bold; 42 | } 43 | .highlight .si { 44 | font-weight: bold; 45 | } 46 | .highlight .se { 47 | font-weight: bold; 48 | } 49 | .highlight .gh { 50 | font-weight: bold; 51 | } 52 | .highlight .gu { 53 | font-weight: bold; 54 | } 55 | .highlight .ge { 56 | font-style: italic; 57 | } 58 | .highlight .gs { 59 | font-weight: bold; 60 | } 61 | .highlight .gp { 62 | font-weight: bold; 63 | } 64 | .highlight .err { 65 | color: #FF0000; 66 | } 67 | -------------------------------------------------------------------------------- /_chapters/010-chapterbook-theme/050-wide-tables.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Wide tables 3 | slug: wide-tables 4 | abstract: Making sure tables look good on mobile. 5 | --- 6 | 7 | Tables can be created using normal [GitHub-flavored markdown](https://github.github.com/gfm/#tables-extension-). 8 | 9 | To prevent wide tables from breaking the book layout on mobile devices, 10 | wrap them in a `
` directly in the markdown file, 11 | with `class="table-wrapper"` and the attribute `markdown="block"`. 12 | 13 | ```html 14 |
15 | 16 | | Semi-tones (frets) | Interval | Note from C | Short scale degree name | Scale degree name | Frequency ratio (dissonance) | 17 | |:--:|:-------------------|:------:|:------:|:----------------------|:-----:| 18 | | 0 | unison (P1) | C | 1 | tonic, one | 1:1 | 19 | | 1 | minor second (m2) | C#/ Db | b2 | flat two | 25:24 | 20 | | 2 | major second (M2) | D | 2 | two | 9:8 | 21 | 22 |
23 | ``` 24 | 25 | ...renders as: 26 |
27 | 28 | | Semi-tones (frets) | Interval | Note from C | Short scale degree name | Scale degree name | Frequency ratio (dissonance) | 29 | |:--:|:-------------------|:------:|:------:|:----------------------|:-----:| 30 | | 0 | unison (P1) | C | 1 | tonic, one | 1:1 | 31 | | 1 | minor second (m2) | C#/ Db | b2 | flat two | 25:24 | 32 | | 2 | major second (M2) | D | 2 | two | 9:8 | 33 | 34 |
35 | 36 | 37 | --- 38 | ``` 39 | This file is located at: {{ page.path }} 40 | ``` 41 | --- 42 | -------------------------------------------------------------------------------- /_includes/footer.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 21 | 22 | 26 | 27 | 28 | 31 | 32 | {% if site.extra_footer_js %} 33 | {%- for extra_js in site.extra_header_js -%} 34 | {%- assign starts_with = extra_js | slice: 0,4 -%} 35 | {% if starts_with == "http" %} 36 | 37 | {%- else -%} 38 | 39 | {%- endif -%} 40 | {%- endfor -%} 41 | {% endif %} 42 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-lunr/search-lunr.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Define global search engine 6 | function LunrSearchEngine() { 7 | this.index = null; 8 | this.store = {}; 9 | this.name = 'LunrSearchEngine'; 10 | } 11 | 12 | // Initialize lunr by fetching the search index 13 | LunrSearchEngine.prototype.init = function() { 14 | var that = this; 15 | var d = $.Deferred(); 16 | 17 | $.getJSON(gitbook.state.basePath+'/search_index.json') 18 | .then(function(data) { 19 | // eslint-disable-next-line no-undef 20 | that.index = lunr.Index.load(data.index); 21 | that.store = data.store; 22 | d.resolve(); 23 | }); 24 | 25 | return d.promise(); 26 | }; 27 | 28 | // Search for a term and return results 29 | LunrSearchEngine.prototype.search = function(q, offset, length) { 30 | var that = this; 31 | var results = []; 32 | 33 | if (this.index) { 34 | results = $.map(this.index.search(q), function(result) { 35 | var doc = that.store[result.ref]; 36 | 37 | return { 38 | title: doc.title, 39 | url: doc.url, 40 | body: doc.summary || doc.body 41 | }; 42 | }); 43 | } 44 | 45 | return $.Deferred().resolve({ 46 | query: q, 47 | results: results.slice(0, length), 48 | count: results.length 49 | }).promise(); 50 | }; 51 | 52 | // Set gitbook research 53 | gitbook.events.bind('start', function(e, config) { 54 | var engine = gitbook.search.getEngine(); 55 | if (!engine) { 56 | gitbook.search.setEngine(LunrSearchEngine, config); 57 | } 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /_includes/gitbook-metadata.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "page": { 3 | "title": "Introduction", 4 | "level": "1.1", 5 | "depth": 1, 6 | "dir": "ltr" 7 | }, 8 | 9 | "config": { 10 | "plugins": ["fontsettings"], 11 | "styles": { 12 | "ebook": "styles/ebook.css", 13 | "epub": "styles/epub.css", 14 | "mobi": "styles/mobi.css", 15 | "pdf": "styles/pdf.css", 16 | "print": "styles/print.css", 17 | "website": "styles/website.css" 18 | }, 19 | "pluginsConfig": { 20 | "fontsettings": { 21 | "family": "sans", 22 | "size": 2, 23 | "theme": "white" 24 | }, 25 | "theme-default": { 26 | "showLevel": false, 27 | "styles": { 28 | "ebook": "styles/ebook.css", 29 | "epub": "styles/epub.css", 30 | "mobi": "styles/mobi.css", 31 | "pdf": "styles/pdf.css", 32 | "print": "styles/print.css", 33 | "website": "styles/website.css" 34 | } 35 | } 36 | }, 37 | "theme": "default", 38 | "author": "", 39 | "pdf": { 40 | "pageNumbers": true, 41 | "fontSize": 12, 42 | "fontFamily": "Arial", 43 | "paperSize": "a4", 44 | "chapterMark": "pagebreak", 45 | "pageBreaksBefore": "/", 46 | "margin": { 47 | "right": 62, 48 | "left": 62, 49 | "top": 56, 50 | "bottom": 56 51 | } 52 | }, 53 | "structure": { 54 | "langs": "LANGS.md", 55 | "readme": "README.md", 56 | }, 57 | "variables": {}, 58 | "title": "{{site.title}}", 59 | "language": "en", 60 | "gitbook": "*" 61 | }, 62 | "file": { 63 | "path": "{{ page.path }}", 64 | "mtime": "{{ page.date }}", 65 | "type": "markdown" 66 | }, 67 | "gitbook": { 68 | "version": "{{site.gitbook_version}}", 69 | "time": "{{site.time}}" 70 | }, 71 | "basePath": "{{site.baseurl}}", 72 | "book": { 73 | "language": "" 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/base16.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight, .highlight .w { 4 | color: #303030; 5 | } 6 | .highlight .err { 7 | color: #151515; 8 | background-color: #ac4142; 9 | } 10 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs { 11 | color: #505050; 12 | } 13 | .highlight .cp { 14 | color: #f4bf75; 15 | } 16 | .highlight .nt { 17 | color: #f4bf75; 18 | } 19 | .highlight .o, .highlight .ow { 20 | color: #d0d0d0; 21 | } 22 | .highlight .p, .highlight .pi { 23 | color: #d0d0d0; 24 | } 25 | .highlight .gi { 26 | color: #90a959; 27 | } 28 | .highlight .gd { 29 | color: #ac4142; 30 | } 31 | .highlight .gh { 32 | color: #6a9fb5; 33 | background-color: #151515; 34 | font-weight: bold; 35 | } 36 | .highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv { 37 | color: #aa759f; 38 | } 39 | .highlight .kc { 40 | color: #d28445; 41 | } 42 | .highlight .kt { 43 | color: #d28445; 44 | } 45 | .highlight .kd { 46 | color: #d28445; 47 | } 48 | .highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 { 49 | color: #90a959; 50 | } 51 | .highlight .sa { 52 | color: #aa759f; 53 | } 54 | .highlight .sr { 55 | color: #75b5aa; 56 | } 57 | .highlight .si { 58 | color: #8f5536; 59 | } 60 | .highlight .se { 61 | color: #8f5536; 62 | } 63 | .highlight .nn { 64 | color: #f4bf75; 65 | } 66 | .highlight .nc { 67 | color: #f4bf75; 68 | } 69 | .highlight .no { 70 | color: #f4bf75; 71 | } 72 | .highlight .na { 73 | color: #6a9fb5; 74 | } 75 | .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { 76 | color: #90a959; 77 | } 78 | .highlight .ss { 79 | color: #90a959; 80 | } 81 | -------------------------------------------------------------------------------- /_chapters/010-chapterbook-theme/060-variables.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Theme variables 3 | slug: variables 4 | abstract: This theme makes a number of variables related to chapters and parts available to markdown files and Liquid templates. 5 | --- 6 | 7 | The `chapter-vars.html` helper sets a number of variables for this theme, 8 | which can be accessed in markdown files and Liquid templates. 9 | It can also render the variables for inspection. 10 | 11 | Parameters: 12 | - `id`: The `page.id` of the chapter page for which to set variables. 13 | - `slug`: The `page.slug` of the chapter page for which to set variables (ignored if `id` is passed). 14 | - `withnum`: For performance reasons, chapter and part numbers are not computed unless `withnum` is `true`. (To compute only chapter or only part numbers, set `withnum=part` or `withnum=chapter` instead.) 15 | - `inspect`: If true, render the variables to the page, for debugging. 16 | 17 | To set variables for the current chapter: 18 | 19 | {% raw %} 20 | ``` 21 | {% include chapter-vars.html id=page.id withnum="true" %} 22 | ``` 23 | {% endraw %} 24 | 25 | {% include chapter-vars.html id=page.id withnum="true" %} 26 | 27 | Then access them like this: 28 | 29 | {% raw %} 30 | ``` 31 | **Chapter number:** {{ chapter_num }} 32 | ``` 33 | {% endraw %} 34 | 35 | ...which renders: 36 | **Chapter number:** {{ chapter_num }} 37 | 38 | To inspect all the variables, 39 | for debugging: 40 | 41 | {% raw %} 42 | ``` 43 | {% include chapter-vars.html id=page.id inspect="true" withnum="true" %} 44 | ``` 45 | {% endraw %} 46 | 47 | ...which renders this: 48 | 49 | {% include chapter-vars.html id=page.id inspect="true" withnum="true" %} 50 | 51 | To set variables for a different chapter, 52 | you can pass the chapter's `slug`, 53 | like this: 54 | 55 | {% raw %} 56 | ``` 57 | {% include chapter-vars.html slug="contents" withnum="true" inspect="true" %} 58 | ``` 59 | {% endraw %} 60 | 61 | ...which renders this: 62 | 63 | {% include chapter-vars.html slug="contents" withnum="true" inspect="true" %} 64 | 65 | 66 | --- 67 | ``` 68 | This file is located at: {{ page.path }} 69 | ``` 70 | --- 71 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/gruvbox.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight, .highlight .w { 4 | color: #fbf1c7; 5 | background-color: #282828; 6 | } 7 | .highlight .err { 8 | color: #fb4934; 9 | background-color: #282828; 10 | font-weight: bold; 11 | } 12 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs { 13 | color: #928374; 14 | font-style: italic; 15 | } 16 | .highlight .cp { 17 | color: #8ec07c; 18 | } 19 | .highlight .nt { 20 | color: #fb4934; 21 | } 22 | .highlight .o, .highlight .ow { 23 | color: #fbf1c7; 24 | } 25 | .highlight .p, .highlight .pi { 26 | color: #fbf1c7; 27 | } 28 | .highlight .gi { 29 | color: #b8bb26; 30 | background-color: #282828; 31 | } 32 | .highlight .gd { 33 | color: #fb4934; 34 | background-color: #282828; 35 | } 36 | .highlight .gh { 37 | color: #b8bb26; 38 | font-weight: bold; 39 | } 40 | .highlight .k, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv { 41 | color: #fb4934; 42 | } 43 | .highlight .kc { 44 | color: #d3869b; 45 | } 46 | .highlight .kt { 47 | color: #fabd2f; 48 | } 49 | .highlight .kd { 50 | color: #fe8019; 51 | } 52 | .highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 { 53 | color: #b8bb26; 54 | font-style: italic; 55 | } 56 | .highlight .si { 57 | color: #b8bb26; 58 | font-style: italic; 59 | } 60 | .highlight .sr { 61 | color: #b8bb26; 62 | font-style: italic; 63 | } 64 | .highlight .sa { 65 | color: #fb4934; 66 | } 67 | .highlight .se { 68 | color: #fe8019; 69 | } 70 | .highlight .nn { 71 | color: #8ec07c; 72 | } 73 | .highlight .nc { 74 | color: #8ec07c; 75 | } 76 | .highlight .no { 77 | color: #d3869b; 78 | } 79 | .highlight .na { 80 | color: #b8bb26; 81 | } 82 | .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { 83 | color: #d3869b; 84 | } 85 | .highlight .ss { 86 | color: #83a598; 87 | } 88 | -------------------------------------------------------------------------------- /_chapters/999-back/010-references.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: References 3 | slug: references 4 | disable_toc: true 5 | #class: references 6 | --- 7 | 8 | This is an example chapter for citing references. 9 | 10 | See the [Scribbr citation generator](https://www.scribbr.com/citation/generator/) to generate citations in the desired style. 11 | (These examples use APA style.) 12 | 13 | ### Citations in text 14 | 15 | Here's an example citation to be included in a text, 16 | with a link to the references chapter: 17 | 18 | ``` 19 | [(Berg, 1997)](references.html#berg-1997) 20 | ``` 21 | 22 | ...which renders as [(Berg, 1997)](references.html#berg-1997). 23 | 24 | ### Reference list 25 | 26 | Use a "references" chapter in the book's end matter to list all of the complete citations, 27 | and receive inbound links from the in-text citations. 28 | 29 | To use a "hanging indent" citation style like APA, 30 | either set `class: references` in the front matter of the references page, 31 | or wrap them in a div like this directly in the markdown: 32 | 33 | {% raw %} 34 | ```html 35 |
36 | ``` 37 | {% endraw %} 38 | 39 | In order to make inbound anchor links from in-text citations work, 40 | we have to include a link in each reference (like the ISBN link below), 41 | and assign it an `id` attribute with `{:#my-id}`. 42 | 43 | {% raw %} 44 | ``` 45 | Berg, C. (1997). *Mastering Guitar Technique: Process and Essence (Classic Guitar).* Mel Bay Publications, Inc. 46 | [ISBN 978-1-610-65058-8](https://en.wikipedia.org/wiki/Special:BookSources?isbn=978-1-610-65058-8){:#berg-1997}. 47 | ``` 48 | {% endraw %} 49 | 50 | ...which renders as below. 51 | 52 |
53 | 54 | ## References 55 | 56 | 57 | Berg, C. (1997). *Mastering Guitar Technique: Process and Essence (Classic Guitar).* Mel Bay Publications, Inc. 58 | [ISBN 978-1-610-65058-8](https://en.wikipedia.org/wiki/Special:BookSources?isbn=978-1-610-65058-8){:#berg-1997}. 59 | 60 | Berg, C. (2019). *Practicing Music by Design: Historic Virtuosi on Peak Performance* (1st ed.). Routledge. 61 | [ISBN 978-0-429-57631-7](https://en.wikipedia.org/wiki/Special:BookSources?isbn=978-0-429-57631-7){:#berg-2019}. 62 | 63 | ... 64 |
65 | 66 | --- 67 | ``` 68 | This file is located at: {{ page.path }} 69 | ``` 70 | --- 71 | -------------------------------------------------------------------------------- /_chapters/020-dummy-chapters/010-lorem.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: dummy 3 | title: Lorem ipsum 4 | abstract: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 5 | --- 6 | 7 | ## Ut enim 8 | 9 | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 10 | 11 | ## Finibus Bonorum 12 | 13 | Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. 14 | 15 | Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. 16 | 17 | Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? 18 | 19 | Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? 20 | 21 | ## Et Malorum 22 | 23 | At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. 24 | 25 | Et harum quidem rerum facilis est et expedita distinctio. 26 | 27 | Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. 28 | 29 | Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. 30 | 31 | --- 32 | ``` 33 | This file is located at: {{ page.path }} 34 | ``` 35 | --- -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-chapter-fold/chapter-fold.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jQuery'], function(gitbook, $) { 2 | var TOGGLE_CLASSNAME = 'expanded', 3 | CHAPTER = '.chapter', 4 | ARTICLES = '.articles', 5 | TRIGGER_TEMPLATE = '', 6 | LS_NAMESPACE = 'expChapters'; 7 | var init = function () { 8 | // adding the trigger element to each ARTICLES parent and binding the event 9 | var chapterLink = $(ARTICLES).parent(CHAPTER).children('a'); 10 | chapterLink.append($(TRIGGER_TEMPLATE)); 11 | chapterLink.on('click', function (e) { 12 | e.preventDefault(); 13 | //e.stopPropagation(); 14 | toggle($(e.target).closest(CHAPTER)); 15 | }); 16 | 17 | expand(lsItem()); 18 | //expand current selected chapter with it's parents 19 | collapse($(CHAPTER)); 20 | var activeChapter = $(CHAPTER + '.active'); 21 | expand(activeChapter); 22 | expand(activeChapter.parents(CHAPTER)); 23 | } 24 | //on page.change will happend the function. 25 | 26 | var toggle = function ($chapter) { 27 | if ($chapter.hasClass('expanded')) { 28 | collapse($chapter); 29 | } else { 30 | expand($chapter); 31 | //$chapter.addClass('active').siblings().removeClass('active'); 32 | } 33 | } 34 | var collapse = function ($chapter) { 35 | if ($chapter.length && $chapter.hasClass(TOGGLE_CLASSNAME)) { 36 | $chapter.removeClass(TOGGLE_CLASSNAME); 37 | lsItem($chapter); 38 | } 39 | } 40 | var expand = function ($chapter) { 41 | if ($chapter.length && !$chapter.hasClass(TOGGLE_CLASSNAME)) { 42 | $chapter.addClass(TOGGLE_CLASSNAME); 43 | lsItem($chapter); 44 | } 45 | } 46 | var lsItem = function () { 47 | var map = JSON.parse(localStorage.getItem(LS_NAMESPACE)) || {} 48 | if (arguments.length) { 49 | var $chapters = arguments[0]; 50 | $chapters.each(function (index, element) { 51 | var level = $(this).data('level'); 52 | var value = $(this).hasClass(TOGGLE_CLASSNAME); 53 | map[level] = value; 54 | }) 55 | localStorage.setItem(LS_NAMESPACE, JSON.stringify(map)); 56 | } else { 57 | return $(CHAPTER).map(function(index, element){ 58 | if (map[$(this).data('level')]) { 59 | return this; 60 | } 61 | }) 62 | } 63 | } 64 | gitbook.events.bind('page.change', function() { 65 | init() 66 | }); 67 | }); 68 | -------------------------------------------------------------------------------- /_includes/chapterbook-toc.html: -------------------------------------------------------------------------------- 1 | 24 | {% assign _in_nested_part = false %} 25 | {% endif %} 26 | 27 | {% unless i_chapter_is_visible %} 28 | {% unless include.show_drafts and i_chapter_is_draft %} 29 | {% include chapter-iterate-next.html %} 30 | {% continue %} 31 | {% endunless %} 32 | {% endunless %} 33 | 34 | {% if _is_new_part and i_part_label %} 35 |
  • 36 | 45 |
  • 72 | {% assign _in_nested_part = false %} 73 | {% endif %} 74 | -------------------------------------------------------------------------------- /_includes/metadata.json.tpl: -------------------------------------------------------------------------------- 1 | "config": { 2 | "plugins": ["fontsettings", "highlight", "livereload", "lunr", "search", "sharing", "theme-default", "livereload"], 3 | "styles": { 4 | "ebook": "styles/ebook.css", 5 | "epub": "styles/epub.css", 6 | "mobi": "styles/mobi.css", 7 | "pdf": "styles/pdf.css", 8 | "print": "styles/print.css", 9 | "website": "styles/website.css" 10 | }, 11 | "pluginsConfig": { 12 | "fontsettings": { 13 | "family": "sans", 14 | "size": 2, 15 | "theme": "white" 16 | }, 17 | "highlight": {}, 18 | "livereload": {}, 19 | "lunr": { 20 | "ignoreSpecialCharacters": false, 21 | "maxIndexSize": 1000000 22 | }, 23 | "search": {}, 24 | 25 | {%- include gitbook-sharing.json.tpl -%} 26 | 27 | "theme-default": { 28 | "showLevel": false, 29 | "styles": { 30 | "ebook": "styles/ebook.css", 31 | "epub": "styles/epub.css", 32 | "mobi": "styles/mobi.css", 33 | "pdf": "styles/pdf.css", 34 | "print": "styles/print.css", 35 | "website": "styles/website.css" 36 | } 37 | } 38 | }, 39 | "theme": "default", 40 | "author": "Tao He", 41 | "pdf": { 42 | "pageNumbers": true, 43 | "fontSize": 12, 44 | "fontFamily": "Arial", 45 | "paperSize": "a4", 46 | "chapterMark": "pagebreak", 47 | "pageBreaksBefore": "/", 48 | "margin": { 49 | "right": 62, 50 | "left": 62, 51 | "top": 56, 52 | "bottom": 56 53 | } 54 | }, 55 | "structure": { 56 | "langs": "LANGS.md", 57 | "readme": "README.md", 58 | }, 59 | "variables": {}, 60 | "title": "{{site.title}}", 61 | "language": "en", 62 | "gitbook": "*" 63 | }, 64 | "file": { 65 | "path": "{{ page.path }}", 66 | "mtime": "{{ page.date }}", 67 | "type": "markdown" 68 | }, 69 | "gitbook": { 70 | "version": "{{site.gitbook_version}}", 71 | "time": "{{site.time}}" 72 | }, 73 | "basePath": "{{site.baseurl}}", 74 | "book": { 75 | "language": "" 76 | } 77 | -------------------------------------------------------------------------------- /assets/demo/C-maj.svg: -------------------------------------------------------------------------------- 1 | 53R35R -------------------------------------------------------------------------------- /_chapters/020-dummy-chapters/020-neque.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: dummy-3 3 | title: Neque porro quisquam 4 | abstract: Interdum et malesuada fames ac ante ipsum primis in faucibus. 5 | --- 6 | 7 | ## Curabitur ultrices 8 | 9 | Curabitur ultrices consequat mattis. Ut varius velit velit, ac blandit arcu faucibus ultrices. In a tincidunt neque. Sed at est et enim elementum finibus sit amet in enim. Sed scelerisque rhoncus lectus a gravida. Aenean interdum ex felis, nec semper magna feugiat sed. Cras auctor quam quis mattis rhoncus. 10 | 11 | ## Nullam 12 | 13 | Nullam at nunc sit amet nibh sollicitudin vestibulum. 14 | 15 | Fusce eu velit cursus, euismod tellus efficitur, cursus nunc. Donec turpis purus, feugiat ut fringilla ac, pretium pellentesque ex. Cras in lacus massa. 16 | 17 | Aliquam rhoncus diam at dui fringilla, id fringilla lorem sagittis. Nam ac ornare erat. Etiam neque enim, euismod quis eros a, congue tempor sapien. Maecenas interdum sollicitudin lorem vitae posuere. Mauris fringilla iaculis sem a cursus. Fusce viverra, magna vitae iaculis volutpat, justo massa sollicitudin nunc, vitae suscipit nulla mauris in ligula. Donec eu lorem gravida tellus tincidunt elementum. 18 | 19 | Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed blandit arcu eu lacus malesuada interdum. Donec ornare tellus metus, id euismod lectus dictum non. Phasellus iaculis, mauris vitae sodales pharetra, eros sem ultricies arcu, ultricies tincidunt magna odio in metus. Pellentesque tortor ligula, consequat non tellus a, sagittis faucibus enim. Praesent eget congue nisi. Donec vitae porttitor metus, ac laoreet magna. 20 | 21 | ## Mauris facilisis 22 | 23 | Mauris facilisis et ante eget malesuada. Aenean in ullamcorper elit. Quisque ornare fringilla diam, a tincidunt risus laoreet fermentum. Nam iaculis molestie lectus in euismod. Aenean vel nibh tortor. Donec at leo ac erat cursus fringilla. Fusce ligula metus, feugiat sed libero quis, tristique maximus tellus. Donec tempor, quam euismod iaculis lacinia, metus leo sollicitudin felis, sit amet tempus erat ex sed est. 24 | 25 | ## In fermentum 26 | 27 | In fermentum consectetur justo, vel consequat nunc accumsan a. Sed eget feugiat erat. Nullam lacinia dolor id lobortis sagittis. Pellentesque vitae blandit nibh. Sed quam ante, lacinia non rhoncus nec, varius ac sem. Fusce eget sem non libero finibus molestie at ut nunc. Aliquam porta turpis quis elit porta placerat. Donec quis ligula sit amet justo posuere tristique. Proin efficitur est lacus, sit amet sagittis nunc fringilla ac. Nam mollis velit non leo ultricies, nec euismod dolor ultrices. 28 | 29 | --- 30 | ``` 31 | This file is located at: {{ page.path }} 32 | ``` 33 | --- -------------------------------------------------------------------------------- /_chapters/010-chapterbook-theme/020-helpers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Helper includes 3 | slug: helpers 4 | abstract: Helper methods, of a sort, using Jekyll includes. 5 | --- 6 | 7 | In order for this theme to work natively with GitHub pages, 8 | it can't use any custom Jekyll plugins. 9 | But it _can_ do any logic and data manipulation supported by the template language, Liquid. 10 | 11 | So this theme makes extensive use of Liquid templates to act as "helpers", 12 | by including them in a page and passing them parameters using Jekyll's standard [`include`](https://jekyllrb.com/docs/includes/) tag. 13 | 14 | ## Chapter links 15 | 16 | The `chapter-link.html` helper renders a link to the chapter with the specified `slug`, 17 | using its current title and chapter number. 18 | 19 | {% raw %} 20 | ```liquid 21 | See {% include chapter-link.html slug="variables" %}. 22 | ``` 23 | {% endraw %} 24 | 25 | ...renders as: See {% include chapter-link.html slug="variables" %}. 26 | 27 | 28 | Parameters: 29 | - `slug`: Required. The `slug` of the chapter to link to. 30 | - `anchor`: An optional anchor tag to append to the chapter link. 31 | 32 | ## Tables of contents 33 | 34 | The `chapterbook-toc.html` helper allows you to make a table of contents page, 35 | including chapter abstracts (if any). 36 | 37 | Parameters: 38 | - `show_drafts`: If `true`, also show draft chapters. Useful for showing an "outline" view of the book. 39 | 40 | 41 | See example [Table of Contents](toc.html), rendered with: 42 | {% raw %} 43 | ```liquid 44 | {% include chapterbook-toc.html %} 45 | ``` 46 | {% endraw %} 47 | 48 | See example [draft outline](outline.html), rendered with: 49 | {% raw %} 50 | ```liquid 51 | {% include chapterbook-toc.html show_drafts=true %} 52 | ``` 53 | {% endraw %} 54 | 55 | ## Figures 56 | 57 | The `figure.html` helper renders images as figures in the book. 58 | 59 | Parameters: 60 | - `url`: The relative URL to the image (appended to `site.baseurl`). 61 | - `caption`: An optional caption to render beneath the figure. 62 | - `class`: an optional `class` attribute to add to the the HTML `
    ` tag. 63 | 64 | For example: 65 | 66 | {% raw %} 67 | ```jekyll 68 | {% include figure.html 69 | caption="C major chord shape." 70 | url="/assets/demo/C-maj.svg" 71 | class="row" 72 | %} 73 | ``` 74 | {% endraw %} 75 | 76 | ...renders as: 77 | 78 | {% include figure.html 79 | caption="C major chord shape." 80 | url="/assets/demo/C-maj.svg" 81 | class="row" 82 | %} 83 | 84 | 85 | ## Theme variables 86 | 87 | This theme makes a number of variables related to chapters and parts available to markdown files and Liquid templates. 88 | 89 | See {% include chapter-link.html slug="variables" %} for details. 90 | 91 | 92 | 93 | --- 94 | ``` 95 | This file is located at: {{ page.path }} 96 | ``` 97 | --- -------------------------------------------------------------------------------- /_includes/toc-date.html: -------------------------------------------------------------------------------- 1 |
    2 | 61 |
    62 | -------------------------------------------------------------------------------- /_includes/head.html: -------------------------------------------------------------------------------- 1 | {% include head-extra.html %} 2 | 3 | 4 | 5 | {%- if page.layout == 'part' and page_part_label -%} 6 | {{page_part_label|escape}} · {{ site.title | escape }} 7 | {%- elsif page.title -%} 8 | {{ page.title | escape }} · {{ site.title | escape }} 9 | {%- else -%} 10 | {{ site.title | escape }} 11 | {%- endif -%} 12 | 13 | 14 | 15 | 16 | 17 | 18 | {%- if site.author -%} 19 | 20 | {%- endif -%} 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 40 | {% if site.favicon_path %} 41 | 45 | {% endif %} 46 | 47 | {% if site.extra_css %} 48 | {%- for extra_css in site.extra_css -%} 49 | {%- assign starts_with = extra_css | slice: 0, 4 -%} 50 | {% if starts_with == "http" %} 51 | 52 | {%- else -%} 53 | 54 | {%- endif -%} 55 | {%- endfor -%} 56 | {% endif %} 57 | 58 | {% if site.extra_header_js %} 59 | {%- for extra_js in site.extra_header_js -%} 60 | {%- assign starts_with = extra_js | slice: 0, 4 -%} 61 | {% if starts_with == "http" %} 62 | 63 | {%- else -%} 64 | 65 | {%- endif -%} 66 | {%- endfor -%} 67 | {% endif %} 68 | 69 | -------------------------------------------------------------------------------- /_chapters/020-dummy-chapters/020-dolor.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: dummy2 3 | title: Dolor sit amet 4 | abstract: Dolor sit amet, consectetur adipiscing elit. Vestibulum varius maximus erat, quis faucibus nulla venenatis eget. 5 | --- 6 | 7 | ## Lorem ipsum 8 | 9 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius maximus erat, quis faucibus nulla venenatis eget. 10 | 11 | Pellentesque sed felis sit amet dui feugiat sagittis eu id lacus. Phasellus viverra, turpis quis rutrum facilisis, libero urna ultrices mauris, non sollicitudin justo eros id eros. 12 | 13 | Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Fusce ut lectus est. Nulla pretium arcu in leo aliquam, nec iaculis leo consequat. Praesent nec ligula ac justo vestibulum iaculis. Vivamus sodales vestibulum velit vel posuere. Sed tempus lobortis urna, nec sagittis orci mollis nec. 14 | 15 | Praesent suscipit velit elit, vel pharetra nisi accumsan nec. Curabitur aliquam ornare lorem, eget venenatis tortor semper ac. Curabitur porta viverra hendrerit. Vestibulum at ultrices nisi, sit amet placerat felis. 16 | 17 | ## Integer lacinia sit amet 18 | 19 | Integer lacinia sit amet tortor sed viverra. Maecenas blandit metus ipsum, condimentum pretium eros porttitor et. Mauris convallis, justo rutrum feugiat mattis, justo velit convallis sem, eu suscipit magna felis a magna. Curabitur malesuada dolor in mauris rhoncus luctus. 20 | 21 | Etiam ex diam, varius non enim quis, cursus commodo ex. Nunc non lorem magna. Etiam tincidunt dui quis lorem posuere, finibus interdum tortor dapibus. Maecenas vitae dui eget dolor egestas maximus vel ac ligula. 22 | 23 | Donec in blandit nisl. Maecenas vel metus non sem dignissim vestibulum. Praesent a tortor nulla. Vestibulum eu ligula orci. Nam a nibh tincidunt, pharetra augue a, ultricies est. Maecenas at tellus accumsan, aliquet nisi vitae, dapibus ligula. Mauris interdum nulla vel condimentum venenatis. 24 | 25 | ## Ut sed sapien mi 26 | 27 | Ut sed sapien mi. Aenean blandit velit tincidunt libero pulvinar rutrum. 28 | 29 | In posuere lacus nunc. Suspendisse rhoncus ligula in posuere tempus. Nam vel congue justo, non fermentum velit. Nam eu leo condimentum, pulvinar tortor eget, hendrerit leo. Praesent luctus lectus ac egestas tincidunt. Praesent ut lacus eros. Vestibulum orci nunc, imperdiet vitae convallis vel, venenatis aliquet urna. 30 | 31 | Fusce posuere dui quis rutrum cursus. Curabitur accumsan risus et ante dictum elementum. 32 | 33 | 34 | ## Sed ut urna tellus 35 | 36 | Aliquam quis fringilla nunc. In ullamcorper enim elit, ut mollis nulla tempus in. Nullam euismod elit sed augue mattis vehicula. 37 | 38 | Nunc viverra rhoncus diam, ut pulvinar mi mattis aliquet. Aliquam non pharetra nunc. Donec vitae odio et libero vehicula pharetra. Praesent imperdiet augue sed orci viverra, et mollis nisi fermentum. Quisque viverra sapien eget eros pulvinar dignissim. Integer dapibus tempus turpis et pulvinar. Suspendisse dapibus elementum tortor, non finibus dui fermentum ac. 39 | 40 | --- 41 | ``` 42 | This file is located at: {{ page.path }} 43 | ``` 44 | --- 45 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/pastie.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1 { 4 | color: #888888; 5 | } 6 | .highlight .cp { 7 | color: #cc0000; 8 | font-weight: bold; 9 | } 10 | .highlight .cs { 11 | color: #cc0000; 12 | background-color: #fff0f0; 13 | font-weight: bold; 14 | } 15 | .highlight .err { 16 | color: #a61717; 17 | background-color: #e3d2d2; 18 | } 19 | .highlight .gr { 20 | color: #aa0000; 21 | } 22 | .highlight .gh { 23 | color: #333333; 24 | } 25 | .highlight .gu { 26 | color: #666666; 27 | } 28 | .highlight .gd { 29 | color: #000000; 30 | background-color: #ffdddd; 31 | } 32 | .highlight .gi { 33 | color: #000000; 34 | background-color: #ddffdd; 35 | } 36 | .highlight .ge { 37 | font-style: italic; 38 | } 39 | .highlight .gs { 40 | font-weight: bold; 41 | } 42 | .highlight .gl { 43 | color: #888888; 44 | } 45 | .highlight .go { 46 | color: #888888; 47 | } 48 | .highlight .gp { 49 | color: #555555; 50 | } 51 | .highlight .gt { 52 | color: #aa0000; 53 | } 54 | .highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kv { 55 | color: #008800; 56 | font-weight: bold; 57 | } 58 | .highlight .kp { 59 | color: #008800; 60 | } 61 | .highlight .kt { 62 | color: #888888; 63 | font-weight: bold; 64 | } 65 | .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { 66 | color: #0000dd; 67 | font-weight: bold; 68 | } 69 | .highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .s1 { 70 | color: #dd2200; 71 | background-color: #fff0f0; 72 | } 73 | .highlight .sa { 74 | color: #008800; 75 | font-weight: bold; 76 | } 77 | .highlight .se { 78 | color: #0044dd; 79 | background-color: #fff0f0; 80 | } 81 | .highlight .si { 82 | color: #3333bb; 83 | background-color: #fff0f0; 84 | } 85 | .highlight .sx { 86 | color: #22bb22; 87 | background-color: #f0fff0; 88 | } 89 | .highlight .sr { 90 | color: #008800; 91 | } 92 | .highlight .ss { 93 | color: #aa6600; 94 | background-color: #fff0f0; 95 | } 96 | .highlight .na { 97 | color: #336699; 98 | } 99 | .highlight .nb, .highlight .bp { 100 | color: #003388; 101 | } 102 | .highlight .nc { 103 | color: #bb0066; 104 | font-weight: bold; 105 | } 106 | .highlight .no { 107 | color: #003366; 108 | font-weight: bold; 109 | } 110 | .highlight .nd { 111 | color: #555555; 112 | } 113 | .highlight .ne { 114 | color: #bb0066; 115 | font-weight: bold; 116 | } 117 | .highlight .nf, .highlight .fm { 118 | color: #0066bb; 119 | font-weight: bold; 120 | } 121 | .highlight .nl { 122 | color: #336699; 123 | } 124 | .highlight .nn { 125 | color: #bb0066; 126 | font-weight: bold; 127 | } 128 | .highlight .py { 129 | color: #336699; 130 | font-weight: bold; 131 | } 132 | .highlight .nt { 133 | color: #bb0066; 134 | font-weight: bold; 135 | } 136 | .highlight .nv, .highlight .vc, .highlight .vm { 137 | color: #336699; 138 | } 139 | .highlight .vg { 140 | color: #dd7700; 141 | } 142 | .highlight .vi { 143 | color: #3333bb; 144 | } 145 | .highlight .ow { 146 | color: #008800; 147 | } 148 | .highlight .w { 149 | color: #bbbbbb; 150 | } 151 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/colorful.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight, .highlight .w { 4 | color: #bbbbbb; 5 | background-color: #000; 6 | } 7 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1 { 8 | color: #888; 9 | } 10 | .highlight .cp { 11 | color: #579; 12 | } 13 | .highlight .cs { 14 | color: #cc0000; 15 | font-weight: bold; 16 | } 17 | .highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kv { 18 | color: #080; 19 | font-weight: bold; 20 | } 21 | .highlight .kp { 22 | color: #038; 23 | } 24 | .highlight .kt { 25 | color: #339; 26 | } 27 | .highlight .o { 28 | color: #333; 29 | } 30 | .highlight .ow { 31 | color: #000; 32 | font-weight: bold; 33 | } 34 | .highlight .nb, .highlight .bp { 35 | color: #007020; 36 | } 37 | .highlight .nf, .highlight .fm { 38 | color: #06B; 39 | font-weight: bold; 40 | } 41 | .highlight .nc { 42 | color: #B06; 43 | font-weight: bold; 44 | } 45 | .highlight .nn { 46 | color: #0e84b5; 47 | font-weight: bold; 48 | } 49 | .highlight .ne { 50 | color: #F00; 51 | font-weight: bold; 52 | } 53 | .highlight .nv, .highlight .vm { 54 | color: #963; 55 | } 56 | .highlight .vi { 57 | color: #33B; 58 | } 59 | .highlight .vc { 60 | color: #369; 61 | } 62 | .highlight .vg { 63 | color: #d70; 64 | font-weight: bold; 65 | } 66 | .highlight .no { 67 | color: #036; 68 | font-weight: bold; 69 | } 70 | .highlight .nl { 71 | color: #970; 72 | font-weight: bold; 73 | } 74 | .highlight .ni { 75 | color: #800; 76 | font-weight: bold; 77 | } 78 | .highlight .na { 79 | color: #00C; 80 | } 81 | .highlight .nt { 82 | color: #070; 83 | } 84 | .highlight .nd { 85 | color: #555; 86 | font-weight: bold; 87 | } 88 | .highlight .s, .highlight .sb, .highlight .dl, .highlight .s2, .highlight .sh, .highlight .s1 { 89 | background-color: #fff0f0; 90 | } 91 | .highlight .sa { 92 | color: #080; 93 | font-weight: bold; 94 | } 95 | .highlight .sc { 96 | color: #04D; 97 | } 98 | .highlight .sd { 99 | color: #D42; 100 | } 101 | .highlight .si { 102 | background-color: #eee; 103 | } 104 | .highlight .se { 105 | color: #666; 106 | font-weight: bold; 107 | } 108 | .highlight .sr { 109 | color: #000; 110 | background-color: #fff0ff; 111 | } 112 | .highlight .ss { 113 | color: #A60; 114 | } 115 | .highlight .sx { 116 | color: #D20; 117 | } 118 | .highlight .m, .highlight .mb, .highlight .mx { 119 | color: #60E; 120 | font-weight: bold; 121 | } 122 | .highlight .mi, .highlight .il { 123 | color: #00D; 124 | font-weight: bold; 125 | } 126 | .highlight .mf { 127 | color: #60E; 128 | font-weight: bold; 129 | } 130 | .highlight .mh { 131 | color: #058; 132 | font-weight: bold; 133 | } 134 | .highlight .mo { 135 | color: #40E; 136 | font-weight: bold; 137 | } 138 | .highlight .gh { 139 | color: #000080; 140 | font-weight: bold; 141 | } 142 | .highlight .gu { 143 | color: #800080; 144 | font-weight: bold; 145 | } 146 | .highlight .gd { 147 | color: #A00000; 148 | } 149 | .highlight .gi { 150 | color: #00A000; 151 | } 152 | .highlight .gr { 153 | color: #FF0000; 154 | } 155 | .highlight .ge { 156 | font-style: italic; 157 | } 158 | .highlight .gs { 159 | font-weight: bold; 160 | } 161 | .highlight .gp { 162 | color: #c65d09; 163 | font-weight: bold; 164 | } 165 | .highlight .go { 166 | color: #888; 167 | } 168 | .highlight .gt { 169 | color: #04D; 170 | } 171 | .highlight .err { 172 | color: #F00; 173 | background-color: #FAA; 174 | } 175 | -------------------------------------------------------------------------------- /_includes/build-chapter-nav.html: -------------------------------------------------------------------------------- 1 | {% unless chapter-nav %} 2 | {% capture chapter-nav %} 3 |
    4 | 95 |
    96 | {% endcapture %} 97 | {% endunless %} 98 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/tulip.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight { 4 | color: #FFFFFF; 5 | background-color: #231529; 6 | } 7 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs { 8 | color: #6D6E70; 9 | font-style: italic; 10 | } 11 | .highlight .cp { 12 | color: #41ff5b; 13 | font-weight: bold; 14 | } 15 | .highlight .err { 16 | color: #FFFFFF; 17 | background-color: #CC0000; 18 | } 19 | .highlight .gr { 20 | color: #FFFFFF; 21 | background-color: #CC0000; 22 | } 23 | .highlight .k, .highlight .kd, .highlight .kv { 24 | color: #FFF02A; 25 | font-weight: bold; 26 | } 27 | .highlight .o, .highlight .ow { 28 | color: #41ff5b; 29 | } 30 | .highlight .p, .highlight .pi { 31 | color: #41ff5b; 32 | } 33 | .highlight .gd { 34 | color: #CC0000; 35 | } 36 | .highlight .gi { 37 | color: #3FB34F; 38 | } 39 | .highlight .ge { 40 | font-style: italic; 41 | } 42 | .highlight .gs { 43 | font-weight: bold; 44 | } 45 | .highlight .gt { 46 | color: #FFFFFF; 47 | background-color: #766DAF; 48 | } 49 | .highlight .gl { 50 | color: #FFFFFF; 51 | background-color: #766DAF; 52 | } 53 | .highlight .kc { 54 | color: #9f93e6; 55 | font-weight: bold; 56 | } 57 | .highlight .kn { 58 | color: #FFFFFF; 59 | font-weight: bold; 60 | } 61 | .highlight .kp { 62 | color: #FFFFFF; 63 | font-weight: bold; 64 | } 65 | .highlight .kr { 66 | color: #FFFFFF; 67 | font-weight: bold; 68 | } 69 | .highlight .gh { 70 | color: #FFFFFF; 71 | font-weight: bold; 72 | } 73 | .highlight .gu { 74 | color: #FFFFFF; 75 | font-weight: bold; 76 | } 77 | .highlight .kt { 78 | color: #FAAF4C; 79 | font-weight: bold; 80 | } 81 | .highlight .no { 82 | color: #FAAF4C; 83 | font-weight: bold; 84 | } 85 | .highlight .nc { 86 | color: #FAAF4C; 87 | font-weight: bold; 88 | } 89 | .highlight .nd { 90 | color: #FAAF4C; 91 | font-weight: bold; 92 | } 93 | .highlight .nn { 94 | color: #FAAF4C; 95 | font-weight: bold; 96 | } 97 | .highlight .bp { 98 | color: #FAAF4C; 99 | font-weight: bold; 100 | } 101 | .highlight .ne { 102 | color: #FAAF4C; 103 | font-weight: bold; 104 | } 105 | .highlight .nl { 106 | color: #9f93e6; 107 | font-weight: bold; 108 | } 109 | .highlight .nt { 110 | color: #9f93e6; 111 | font-weight: bold; 112 | } 113 | .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { 114 | color: #9f93e6; 115 | font-weight: bold; 116 | } 117 | .highlight .ld { 118 | color: #9f93e6; 119 | font-weight: bold; 120 | } 121 | .highlight .ss { 122 | color: #9f93e6; 123 | font-weight: bold; 124 | } 125 | .highlight .s, .highlight .sb, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .sr, .highlight .s1 { 126 | color: #fff0a6; 127 | font-weight: bold; 128 | } 129 | .highlight .sa { 130 | color: #FFF02A; 131 | font-weight: bold; 132 | } 133 | .highlight .se { 134 | color: #FAAF4C; 135 | font-weight: bold; 136 | } 137 | .highlight .sc { 138 | color: #FAAF4C; 139 | font-weight: bold; 140 | } 141 | .highlight .si { 142 | color: #FAAF4C; 143 | font-weight: bold; 144 | } 145 | .highlight .nb { 146 | font-weight: bold; 147 | } 148 | .highlight .ni { 149 | color: #999999; 150 | font-weight: bold; 151 | } 152 | .highlight .w { 153 | color: #BBBBBB; 154 | } 155 | .highlight .nf, .highlight .fm { 156 | color: #41ff5b; 157 | } 158 | .highlight .py { 159 | color: #41ff5b; 160 | } 161 | .highlight .na { 162 | color: #41ff5b; 163 | } 164 | .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm { 165 | color: #41ff5b; 166 | font-weight: bold; 167 | } 168 | -------------------------------------------------------------------------------- /_includes/chapter-iterate-current.html: -------------------------------------------------------------------------------- 1 | {% assign i_chapter = site.chapters[i_chapter_idx] %} 2 | 3 | {% if i_chapter %} 4 | {% comment %} 5 | # 6 | # Determine if chapter is visible and/or draft and/or an index page for a part 7 | # 8 | {% endcomment %} 9 | {% assign i_chapter_is_draft = false %} 10 | {% assign i_chapter_is_visible = true %} 11 | {% assign i_chapter_basename = i_chapter.path | split: "/" | last %} 12 | {% assign i_chapter_sort_index = i_chapter_basename | split: "-" | first %} 13 | {% assign i_chapter_sort_index_ext = nil %} 14 | 15 | {% assign i_chapter_is_part_index = false %} 16 | {% if i_chapter_basename == "000-index.md" %} 17 | {% assign i_chapter_is_part_index = true %} 18 | {% endif %} 19 | 20 | {% unless i_chapter_is_part_index %} 21 | {% if i_chapter_sort_index contains "." %} 22 | {% assign i_chapter_sort_index_ext = i_chapter_sort_index | split: "." | last %} 23 | {% endif %} 24 | {% if i_chapter_sort_index_ext == "draft" %} 25 | {% assign i_chapter_is_draft = true %} 26 | {% unless jekyll.environment == "development" and site.show_drafts_in_dev %} 27 | {% assign i_chapter_is_visible = false %} 28 | {% endunless %} 29 | {% endif %} 30 | {% endunless %} 31 | 32 | {% comment %} 33 | # 34 | # Determine part info other than number 35 | # 36 | {% endcomment %} 37 | {% assign i_part_folder = i_chapter.path | split: "/" | slice: -2 | first %} 38 | {% if i_part_folder == "_chapters" %} 39 | {% assign i_part_folder = nil %} 40 | {% assign i_part_unnumbered = false %} 41 | {% assign i_part_label = nil %} 42 | {% assign i_part_index_chapter = nil %} 43 | {% endif %} 44 | {% if i_part_folder %} 45 | {% assign i_part_sort_index = i_part_folder | split: "-" | first %} 46 | {% if i_part_sort_index contains "." %} 47 | {% assign i_part_sort_index_ext = i_part_sort_index | split: "." | last %} 48 | {% else %} 49 | {% assign i_part_sort_index_ext = nil %} 50 | {% endif %} 51 | 52 | {% if i_part_sort_index_ext == "draft" %} 53 | {% assign i_part_is_draft = true %} 54 | {% else %} 55 | {% assign i_part_is_draft = false %} 56 | {% endif %} 57 | 58 | {% capture _part_index_path %}_chapters/{{ i_part_folder}}/000-index.md{% endcapture %} 59 | {% assign i_part_index_chapter = site.chapters | where: "path", _part_index_path | first %} 60 | 61 | {% if i_part_sort_index == "000" or i_part_sort_index == "999" %} 62 | {% assign i_part_unnumbered = true %} 63 | {% assign i_part_label = nil %} 64 | {% else %} 65 | {% assign i_part_unnumbered = false %} 66 | {% assign i_part_label = i_part_folder | split: "-" | shift | join: " " | capitalize %} 67 | {% endif %} 68 | 69 | {% endif %} 70 | 71 | {% comment %} 72 | # 73 | # Determine part and chapter numbers 74 | # 75 | {% endcomment %} 76 | 77 | {% if i_part_unnumbered %} 78 | {% assign i_chapter_num = nil %} 79 | {% assign i_part_num = nil %} 80 | {% else %} 81 | {% if i_chapter_is_draft %} 82 | {% assign i_chapter_num = "X" %} 83 | {% elsif i_chapter_is_part_index %} 84 | {% assign i_chapter_num = "" %} 85 | {% elsif i_chapter_is_visible %} 86 | {% assign i_chapter_num = i_last_numeric_chapter_num | plus: 1 %} 87 | {% assign i_last_numeric_chapter_num = i_chapter_num %} 88 | {% else %} 89 | {% assign i_chapter_num = "" %} 90 | {% endif %} 91 | 92 | {% if i_part_folder and i_part_folder != i_prev_part_folder %} 93 | {% if i_part_is_draft %} 94 | {% assign i_part_num = "X" %} 95 | {% else %} 96 | {% assign i_part_num = i_last_numeric_part_num | plus: 1 %} 97 | {% assign i_last_numeric_part_num = i_part_num %} 98 | {% endif %} 99 | {% endif %} 100 | {% endif %} 101 | 102 | {% else %} 103 | {% include chapter-iterate-vars.html unset = "current" %} 104 | {% endif %} -------------------------------------------------------------------------------- /assets/gitbook/rouge/magritte.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight { 4 | color: #000707; 5 | background-color: #f3ffff; 6 | } 7 | .highlight .gl { 8 | color: #f3ffff; 9 | background-color: #000707; 10 | } 11 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs { 12 | color: #006c6c; 13 | font-style: italic; 14 | } 15 | .highlight .cp { 16 | color: #920241; 17 | font-weight: bold; 18 | } 19 | .highlight .err { 20 | color: #f3ffff; 21 | background-color: #f22700; 22 | } 23 | .highlight .gr { 24 | color: #f22700; 25 | font-weight: bold; 26 | font-style: italic; 27 | } 28 | .highlight .k, .highlight .kd, .highlight .kv { 29 | color: #19003a; 30 | font-weight: bold; 31 | } 32 | .highlight .o, .highlight .ow { 33 | color: #4c48fe; 34 | font-weight: bold; 35 | } 36 | .highlight .p, .highlight .pi { 37 | color: #4c48fe; 38 | } 39 | .highlight .gd { 40 | color: #f22700; 41 | } 42 | .highlight .gi { 43 | color: #007500; 44 | } 45 | .highlight .ge { 46 | font-style: italic; 47 | } 48 | .highlight .gs { 49 | font-weight: bold; 50 | } 51 | .highlight .gt { 52 | color: #000000; 53 | background-color: #d8d9ff; 54 | } 55 | .highlight .kc { 56 | color: #007500; 57 | font-weight: bold; 58 | } 59 | .highlight .kn { 60 | color: #007500; 61 | font-weight: bold; 62 | } 63 | .highlight .kp { 64 | color: #007500; 65 | font-weight: bold; 66 | } 67 | .highlight .kr { 68 | color: #007500; 69 | font-weight: bold; 70 | } 71 | .highlight .gh { 72 | color: #007500; 73 | font-weight: bold; 74 | } 75 | .highlight .gu { 76 | color: #007500; 77 | font-weight: bold; 78 | } 79 | .highlight .kt { 80 | color: #920241; 81 | font-weight: bold; 82 | } 83 | .highlight .no { 84 | color: #920241; 85 | font-weight: bold; 86 | } 87 | .highlight .nc { 88 | color: #920241; 89 | font-weight: bold; 90 | } 91 | .highlight .nd { 92 | color: #920241; 93 | font-weight: bold; 94 | } 95 | .highlight .nn { 96 | color: #920241; 97 | font-weight: bold; 98 | } 99 | .highlight .bp { 100 | color: #920241; 101 | font-weight: bold; 102 | } 103 | .highlight .ne { 104 | color: #920241; 105 | font-weight: bold; 106 | } 107 | .highlight .nl { 108 | color: #840084; 109 | font-weight: bold; 110 | } 111 | .highlight .nt { 112 | color: #840084; 113 | font-weight: bold; 114 | } 115 | .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { 116 | color: #007500; 117 | font-weight: bold; 118 | } 119 | .highlight .ld { 120 | color: #007500; 121 | font-weight: bold; 122 | } 123 | .highlight .ss { 124 | color: #007500; 125 | } 126 | .highlight .s, .highlight .sb, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .sr, .highlight .s1 { 127 | color: #7c0000; 128 | font-weight: bold; 129 | } 130 | .highlight .sa { 131 | color: #19003a; 132 | font-weight: bold; 133 | } 134 | .highlight .se { 135 | color: #840084; 136 | font-weight: bold; 137 | } 138 | .highlight .sc { 139 | color: #840084; 140 | font-weight: bold; 141 | } 142 | .highlight .si { 143 | color: #840084; 144 | font-weight: bold; 145 | } 146 | .highlight .nb { 147 | font-weight: bold; 148 | } 149 | .highlight .ni { 150 | color: #999999; 151 | font-weight: bold; 152 | } 153 | .highlight .w { 154 | color: #BBBBBB; 155 | } 156 | .highlight .go { 157 | color: #19003a; 158 | } 159 | .highlight .nf, .highlight .fm { 160 | color: #ff0089; 161 | } 162 | .highlight .py { 163 | color: #ff0089; 164 | } 165 | .highlight .na { 166 | color: #ff0089; 167 | } 168 | .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm { 169 | color: #ff0089; 170 | font-weight: bold; 171 | } 172 | -------------------------------------------------------------------------------- /_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {% include build-chapter-nav.html %} 5 | 6 | {%- include head.html -%} 7 | 8 | {% if site.baseurl_canonical %} 9 | 10 | {% endif %} 11 | 12 | {% if page.collection == "chapters" %} 13 | {% if page_prev_chapter %} 14 | 15 | {% else %} 16 | 17 | {% endif %} 18 | 19 | {% if page_next_chapter %} 20 | 21 | {% endif %} 22 | {% endif %} 23 | 24 | 25 | 26 |
    27 | {{ chapter-nav }} 28 | 29 |
    30 | 44 | 45 | 46 |
    47 |
    51 |
    52 | 53 | {% include above-content.html %} 54 | 55 | {{ content }} 56 | 57 | {% include below-content.html %} 58 | 59 |
    60 | 61 |
    62 | 63 |
    64 | 65 | 105 | 106 | 107 |
    108 | 109 |
    110 | 111 | 112 | {%- include footer.html -%} 113 | 114 | 120 | 121 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/thankful_eyes.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight { 4 | color: #faf6e4; 5 | background-color: #122b3b; 6 | } 7 | .highlight .gl { 8 | color: #dee5e7; 9 | background-color: #4e5d62; 10 | } 11 | .highlight .gp { 12 | color: #a8e1fe; 13 | font-weight: bold; 14 | } 15 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf, .highlight .c1, .highlight .cs { 16 | color: #6c8b9f; 17 | font-style: italic; 18 | } 19 | .highlight .cp { 20 | color: #b2fd6d; 21 | font-weight: bold; 22 | } 23 | .highlight .err { 24 | color: #fefeec; 25 | background-color: #cc0000; 26 | } 27 | .highlight .gr { 28 | color: #cc0000; 29 | font-weight: bold; 30 | font-style: italic; 31 | } 32 | .highlight .k, .highlight .kd, .highlight .kv { 33 | color: #f6dd62; 34 | font-weight: bold; 35 | } 36 | .highlight .o, .highlight .ow { 37 | color: #4df4ff; 38 | font-weight: bold; 39 | } 40 | .highlight .p, .highlight .pi { 41 | color: #4df4ff; 42 | } 43 | .highlight .gd { 44 | color: #cc0000; 45 | } 46 | .highlight .gi { 47 | color: #b2fd6d; 48 | } 49 | .highlight .ge { 50 | font-style: italic; 51 | } 52 | .highlight .gs { 53 | font-weight: bold; 54 | } 55 | .highlight .gt { 56 | color: #dee5e7; 57 | background-color: #4e5d62; 58 | } 59 | .highlight .kc { 60 | color: #f696db; 61 | font-weight: bold; 62 | } 63 | .highlight .kn { 64 | color: #ffb000; 65 | font-weight: bold; 66 | } 67 | .highlight .kp { 68 | color: #ffb000; 69 | font-weight: bold; 70 | } 71 | .highlight .kr { 72 | color: #ffb000; 73 | font-weight: bold; 74 | } 75 | .highlight .gh { 76 | color: #ffb000; 77 | font-weight: bold; 78 | } 79 | .highlight .gu { 80 | color: #ffb000; 81 | font-weight: bold; 82 | } 83 | .highlight .kt { 84 | color: #b2fd6d; 85 | font-weight: bold; 86 | } 87 | .highlight .no { 88 | color: #b2fd6d; 89 | font-weight: bold; 90 | } 91 | .highlight .nc { 92 | color: #b2fd6d; 93 | font-weight: bold; 94 | } 95 | .highlight .nd { 96 | color: #b2fd6d; 97 | font-weight: bold; 98 | } 99 | .highlight .nn { 100 | color: #b2fd6d; 101 | font-weight: bold; 102 | } 103 | .highlight .bp { 104 | color: #b2fd6d; 105 | font-weight: bold; 106 | } 107 | .highlight .ne { 108 | color: #b2fd6d; 109 | font-weight: bold; 110 | } 111 | .highlight .nl { 112 | color: #ffb000; 113 | font-weight: bold; 114 | } 115 | .highlight .nt { 116 | color: #ffb000; 117 | font-weight: bold; 118 | } 119 | .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx { 120 | color: #f696db; 121 | font-weight: bold; 122 | } 123 | .highlight .ld { 124 | color: #f696db; 125 | font-weight: bold; 126 | } 127 | .highlight .ss { 128 | color: #f696db; 129 | font-weight: bold; 130 | } 131 | .highlight .s, .highlight .sb, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .sr, .highlight .s1 { 132 | color: #fff0a6; 133 | font-weight: bold; 134 | } 135 | .highlight .sa { 136 | color: #f6dd62; 137 | font-weight: bold; 138 | } 139 | .highlight .se { 140 | color: #4df4ff; 141 | font-weight: bold; 142 | } 143 | .highlight .sc { 144 | color: #4df4ff; 145 | font-weight: bold; 146 | } 147 | .highlight .si { 148 | color: #4df4ff; 149 | font-weight: bold; 150 | } 151 | .highlight .nb { 152 | font-weight: bold; 153 | } 154 | .highlight .ni { 155 | color: #999999; 156 | font-weight: bold; 157 | } 158 | .highlight .w { 159 | color: #BBBBBB; 160 | } 161 | .highlight .go { 162 | color: #BBBBBB; 163 | } 164 | .highlight .nf, .highlight .fm { 165 | color: #a8e1fe; 166 | } 167 | .highlight .py { 168 | color: #a8e1fe; 169 | } 170 | .highlight .na { 171 | color: #a8e1fe; 172 | } 173 | .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm { 174 | color: #a8e1fe; 175 | font-weight: bold; 176 | } 177 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/molokai.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf { 4 | color: #5e5d83; 5 | font-style: italic; 6 | } 7 | .highlight .cm { 8 | color: #5e5d83; 9 | font-style: italic; 10 | } 11 | .highlight .c1 { 12 | color: #5e5d83; 13 | font-style: italic; 14 | } 15 | .highlight .cp { 16 | color: #465457; 17 | font-weight: bold; 18 | } 19 | .highlight .cs { 20 | color: #465457; 21 | font-weight: bold; 22 | font-style: italic; 23 | } 24 | .highlight .err { 25 | color: #f8f8f2; 26 | background-color: #403d3d; 27 | } 28 | .highlight .gi { 29 | color: #a6e22e; 30 | } 31 | .highlight .gd { 32 | color: #f92672; 33 | } 34 | .highlight .ge { 35 | color: #1b1d1e; 36 | font-style: italic; 37 | } 38 | .highlight .gr { 39 | color: #f92672; 40 | } 41 | .highlight .gt { 42 | color: #f92672; 43 | } 44 | .highlight .gh { 45 | color: #403d3d; 46 | } 47 | .highlight .go { 48 | color: #403d3d; 49 | } 50 | .highlight .gp { 51 | color: #66d9ef; 52 | } 53 | .highlight .gs { 54 | font-weight: bold; 55 | } 56 | .highlight .gu { 57 | color: #465457; 58 | } 59 | .highlight .k, .highlight .kv { 60 | color: #66d9ef; 61 | font-weight: bold; 62 | } 63 | .highlight .kc { 64 | color: #66d9ef; 65 | font-weight: bold; 66 | } 67 | .highlight .kd { 68 | color: #66d9ef; 69 | font-weight: bold; 70 | } 71 | .highlight .kp { 72 | color: #66d9ef; 73 | font-weight: bold; 74 | } 75 | .highlight .kr { 76 | color: #66d9ef; 77 | font-weight: bold; 78 | } 79 | .highlight .kt { 80 | color: #66d9ef; 81 | font-weight: bold; 82 | } 83 | .highlight .kn { 84 | color: #f92672; 85 | font-weight: bold; 86 | } 87 | .highlight .ow { 88 | color: #f92672; 89 | font-weight: bold; 90 | } 91 | .highlight .o { 92 | color: #f92672; 93 | font-weight: bold; 94 | } 95 | .highlight .mf { 96 | color: #af87ff; 97 | } 98 | .highlight .mh { 99 | color: #af87ff; 100 | } 101 | .highlight .il { 102 | color: #af87ff; 103 | } 104 | .highlight .mi { 105 | color: #af87ff; 106 | } 107 | .highlight .mo { 108 | color: #af87ff; 109 | } 110 | .highlight .m, .highlight .mb, .highlight .mx { 111 | color: #af87ff; 112 | } 113 | .highlight .se { 114 | color: #af87ff; 115 | } 116 | .highlight .sb { 117 | color: #d7d787; 118 | } 119 | .highlight .sc { 120 | color: #d7d787; 121 | } 122 | .highlight .sd { 123 | color: #d7d787; 124 | } 125 | .highlight .s2 { 126 | color: #d7d787; 127 | } 128 | .highlight .sh { 129 | color: #d7d787; 130 | } 131 | .highlight .si { 132 | color: #d7d787; 133 | } 134 | .highlight .sx { 135 | color: #d7d787; 136 | } 137 | .highlight .sr { 138 | color: #d7d787; 139 | } 140 | .highlight .s1 { 141 | color: #d7d787; 142 | } 143 | .highlight .ss { 144 | color: #d7d787; 145 | } 146 | .highlight .s, .highlight .sa, .highlight .dl { 147 | color: #d7d787; 148 | } 149 | .highlight .na { 150 | color: #a6e22e; 151 | } 152 | .highlight .nc { 153 | color: #a6e22e; 154 | font-weight: bold; 155 | } 156 | .highlight .nd { 157 | color: #a6e22e; 158 | font-weight: bold; 159 | } 160 | .highlight .ne { 161 | color: #a6e22e; 162 | font-weight: bold; 163 | } 164 | .highlight .nf, .highlight .fm { 165 | color: #a6e22e; 166 | font-weight: bold; 167 | } 168 | .highlight .no { 169 | color: #66d9ef; 170 | } 171 | .highlight .bp { 172 | color: #f8f8f2; 173 | } 174 | .highlight .nb { 175 | color: #f8f8f2; 176 | } 177 | .highlight .ni { 178 | color: #f8f8f2; 179 | } 180 | .highlight .nn { 181 | color: #f8f8f2; 182 | } 183 | .highlight .vc { 184 | color: #f8f8f2; 185 | } 186 | .highlight .vg { 187 | color: #f8f8f2; 188 | } 189 | .highlight .vi { 190 | color: #f8f8f2; 191 | } 192 | .highlight .nv, .highlight .vm { 193 | color: #f8f8f2; 194 | } 195 | .highlight .w { 196 | color: #f8f8f2; 197 | } 198 | .highlight .nl { 199 | color: #f8f8f2; 200 | font-weight: bold; 201 | } 202 | .highlight .nt { 203 | color: #f92672; 204 | } 205 | .highlight { 206 | color: #f8f8f2; 207 | background-color: #1b1d1e; 208 | } 209 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/github.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight .cm { 4 | color: #999988; 5 | font-style: italic; 6 | } 7 | .highlight .cp { 8 | color: #999999; 9 | font-weight: bold; 10 | } 11 | .highlight .c1 { 12 | color: #999988; 13 | font-style: italic; 14 | } 15 | .highlight .cs { 16 | color: #999999; 17 | font-weight: bold; 18 | font-style: italic; 19 | } 20 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf { 21 | color: #999988; 22 | font-style: italic; 23 | } 24 | .highlight .err { 25 | color: #a61717; 26 | background-color: #e3d2d2; 27 | } 28 | .highlight .gd { 29 | color: #000000; 30 | background-color: #ffdddd; 31 | } 32 | .highlight .ge { 33 | color: #000000; 34 | font-style: italic; 35 | } 36 | .highlight .gr { 37 | color: #aa0000; 38 | } 39 | .highlight .gh { 40 | color: #999999; 41 | } 42 | .highlight .gi { 43 | color: #000000; 44 | background-color: #ddffdd; 45 | } 46 | .highlight .go { 47 | color: #888888; 48 | } 49 | .highlight .gp { 50 | color: #555555; 51 | } 52 | .highlight .gs { 53 | font-weight: bold; 54 | } 55 | .highlight .gu { 56 | color: #aaaaaa; 57 | } 58 | .highlight .gt { 59 | color: #aa0000; 60 | } 61 | .highlight .kc { 62 | color: #000000; 63 | font-weight: bold; 64 | } 65 | .highlight .kd { 66 | color: #000000; 67 | font-weight: bold; 68 | } 69 | .highlight .kn { 70 | color: #000000; 71 | font-weight: bold; 72 | } 73 | .highlight .kp { 74 | color: #000000; 75 | font-weight: bold; 76 | } 77 | .highlight .kr { 78 | color: #000000; 79 | font-weight: bold; 80 | } 81 | .highlight .kt { 82 | color: #445588; 83 | font-weight: bold; 84 | } 85 | .highlight .k, .highlight .kv { 86 | color: #000000; 87 | font-weight: bold; 88 | } 89 | .highlight .mf { 90 | color: #009999; 91 | } 92 | .highlight .mh { 93 | color: #009999; 94 | } 95 | .highlight .il { 96 | color: #009999; 97 | } 98 | .highlight .mi { 99 | color: #009999; 100 | } 101 | .highlight .mo { 102 | color: #009999; 103 | } 104 | .highlight .m, .highlight .mb, .highlight .mx { 105 | color: #009999; 106 | } 107 | .highlight .sa { 108 | color: #000000; 109 | font-weight: bold; 110 | } 111 | .highlight .sb { 112 | color: #d14; 113 | } 114 | .highlight .sc { 115 | color: #d14; 116 | } 117 | .highlight .sd { 118 | color: #d14; 119 | } 120 | .highlight .s2 { 121 | color: #d14; 122 | } 123 | .highlight .se { 124 | color: #d14; 125 | } 126 | .highlight .sh { 127 | color: #d14; 128 | } 129 | .highlight .si { 130 | color: #d14; 131 | } 132 | .highlight .sx { 133 | color: #d14; 134 | } 135 | .highlight .sr { 136 | color: #009926; 137 | } 138 | .highlight .s1 { 139 | color: #d14; 140 | } 141 | .highlight .ss { 142 | color: #990073; 143 | } 144 | .highlight .s, .highlight .dl { 145 | color: #d14; 146 | } 147 | .highlight .na { 148 | color: #008080; 149 | } 150 | .highlight .bp { 151 | color: #999999; 152 | } 153 | .highlight .nb { 154 | color: #0086B3; 155 | } 156 | .highlight .nc { 157 | color: #445588; 158 | font-weight: bold; 159 | } 160 | .highlight .no { 161 | color: #008080; 162 | } 163 | .highlight .nd { 164 | color: #3c5d5d; 165 | font-weight: bold; 166 | } 167 | .highlight .ni { 168 | color: #800080; 169 | } 170 | .highlight .ne { 171 | color: #990000; 172 | font-weight: bold; 173 | } 174 | .highlight .nf, .highlight .fm { 175 | color: #990000; 176 | font-weight: bold; 177 | } 178 | .highlight .nl { 179 | color: #990000; 180 | font-weight: bold; 181 | } 182 | .highlight .nn { 183 | color: #555555; 184 | } 185 | .highlight .nt { 186 | color: #000080; 187 | } 188 | .highlight .vc { 189 | color: #008080; 190 | } 191 | .highlight .vg { 192 | color: #008080; 193 | } 194 | .highlight .vi { 195 | color: #008080; 196 | } 197 | .highlight .nv, .highlight .vm { 198 | color: #008080; 199 | } 200 | .highlight .ow { 201 | color: #000000; 202 | font-weight: bold; 203 | } 204 | .highlight .o { 205 | color: #000000; 206 | font-weight: bold; 207 | } 208 | .highlight .w { 209 | color: #bbbbbb; 210 | } 211 | .highlight { 212 | background-color: #f8f8f8; 213 | } 214 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | remote_theme: jasongrimes/jekyll-chapterbook 2 | 3 | title: Jekyll Chapterbook 4 | longtitle: Jekyll Chapterbook Theme 5 | author: Jason Grimes 6 | email: jason@grimesit.com 7 | description: > 8 | A Jekyll theme based on GitBook with support for chapters and parts. 9 | 10 | # If baseurl_canonical is set, 11 | # a tag will be added to the head of each page, 12 | # to disambiguate links for search engines. 13 | baseurl_canonical: https://jasongrimes.github.io/jekyll-chapterbook 14 | 15 | # A copyright notice will be shown at the bottom of each page, 16 | # with the current year and the author name. 17 | # Set a url to link to a copyright page. 18 | # Set a start_year to have the copyright render as "start_year - current_year" (if the years are different) 19 | # Set copyright: false to disable. 20 | copyright: 21 | start_year: 2023 22 | url: /book.html 23 | 24 | # Customize the link favicon in header. Will be {{site.baseurl}}/{{site.favicon_path}} 25 | favicon_path: assets/gitbook/images/favicon.ico 26 | 27 | # 28 | # Navigation menus 29 | # 30 | 31 | # Breadcrumbs for book contents. 32 | # The book and contents pages need to be made manually. 33 | # All "url" variables should have a leading slash. 34 | bookcrumbs: 35 | book_url: /book.html 36 | contents_url: /contents.html 37 | book_icon: assets/gitbook/images/apple-touch-icon-precomposed-152.png 38 | 39 | # Links shown above the TOC in the sidebar 40 | # All "url" variables should have a leading slash. 41 | sidebar_nav_top: 42 | - label: Jekyll Chapterbook Theme 43 | url: /index.html 44 | 45 | # Links shown below the TOC in the sidebar 46 | # All "url" variables should have a leading slash. 47 | sidebar_nav_bottom: 48 | - label: Draft outline 49 | url: /outline.html 50 | - label: Fork at GitHub 51 | url: https://github.com/jasongrimes/jekyll-chapterbook/fork 52 | 53 | # Navigation shown at the bottom of the page 54 | # All "url" variables should have a leading slash. 55 | bottom_nav: 56 | - label: Home 57 | url: /index.html 58 | - label: Book 59 | url: /book.html 60 | - label: GitHub 61 | url: https://github.com/jasongrimes/jekyll-chapterbook 62 | - label: Privacy 63 | url: /privacy.html 64 | 65 | 66 | # Whether to show chapter headings as a table of contents at the top of each chapter page. 67 | # Override in page front matter with disable_toc: true 68 | in_chapter_toc: 69 | enabled: true 70 | h_min: 2 71 | h_max: 3 72 | 73 | # Whether to show chapter heading sub-navigation beneath the active chapter in the sidebar. 74 | # Override in page front matter with disable_toc: true 75 | sidebar_toc: 76 | enabled: false 77 | h_min: 2 78 | h_max: 3 79 | 80 | # 81 | # End navigation menus 82 | # 83 | 84 | # Show a link to edit each page on GitHub 85 | github_edit: 86 | enabled: true 87 | base_url: https://github.com/jasongrimes/jekyll-chapterbook/edit/master/ 88 | 89 | # Custom CSS 90 | extra_css: 91 | 92 | # Chapters can be hidden from navigation by adding ".draft" to the index at the start of their filename. 93 | # (For example, rename 010-introduction.md to 010.draft-introduction.md) 94 | # 95 | # To make the drafts appear in the navigation in development environments, 96 | # set show_drafts_in_dev to true. 97 | show_drafts_in_dev: false 98 | 99 | 100 | 101 | 102 | 103 | exclude: 104 | - _drafts 105 | - tmp 106 | 107 | page_width: 800px 108 | 109 | destination: ./_site 110 | incremental: false 111 | regenerate: true 112 | 113 | plugins: 114 | # - jekyll-feed 115 | - jekyll-readme-index 116 | # - jemoji 117 | 118 | collections: 119 | chapters: 120 | output: true 121 | pages: 122 | output: true 123 | permalink: /:slug:output_ext 124 | 125 | 126 | defaults: 127 | - 128 | scope: 129 | path: "" 130 | type: "chapters" 131 | values: 132 | layout: "chapter" 133 | permalink: /:slug:output_ext 134 | 135 | # Markdown render engine. 136 | markdown: kramdown 137 | kramdown: 138 | auto_ids: true 139 | input: GFM 140 | math_engine: mathjax 141 | smart_quotes: lsquo,rsquo,ldquo,rdquo 142 | toc_levels: 1..6 143 | syntax_highlighter: rouge 144 | syntax_highlighter_opts: 145 | guess_lang: true 146 | syntax_highlighter_style: colorful 147 | markdown_ext: markdown,mkdown,mkdn,mkd,md 148 | -------------------------------------------------------------------------------- /assets/gitbook/rouge/monokai.css: -------------------------------------------------------------------------------- 1 | .highlight table td { padding: 5px; } 2 | .highlight table pre { margin: 0; } 3 | .highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf { 4 | color: #75715e; 5 | font-style: italic; 6 | } 7 | .highlight .cm { 8 | color: #75715e; 9 | font-style: italic; 10 | } 11 | .highlight .c1 { 12 | color: #75715e; 13 | font-style: italic; 14 | } 15 | .highlight .cp { 16 | color: #75715e; 17 | font-weight: bold; 18 | } 19 | .highlight .cs { 20 | color: #75715e; 21 | font-weight: bold; 22 | font-style: italic; 23 | } 24 | .highlight .err { 25 | color: #960050; 26 | background-color: #1e0010; 27 | } 28 | .highlight .gi { 29 | color: #ffffff; 30 | background-color: #324932; 31 | } 32 | .highlight .gd { 33 | color: #ffffff; 34 | background-color: #493131; 35 | } 36 | .highlight .ge { 37 | color: #000000; 38 | font-style: italic; 39 | } 40 | .highlight .gr { 41 | color: #aa0000; 42 | } 43 | .highlight .gt { 44 | color: #aa0000; 45 | } 46 | .highlight .gh { 47 | color: #999999; 48 | } 49 | .highlight .go { 50 | color: #888888; 51 | } 52 | .highlight .gp { 53 | color: #555555; 54 | } 55 | .highlight .gs { 56 | font-weight: bold; 57 | } 58 | .highlight .gu { 59 | color: #aaaaaa; 60 | } 61 | .highlight .k, .highlight .kv { 62 | color: #66d9ef; 63 | font-weight: bold; 64 | } 65 | .highlight .kc { 66 | color: #66d9ef; 67 | font-weight: bold; 68 | } 69 | .highlight .kd { 70 | color: #66d9ef; 71 | font-weight: bold; 72 | } 73 | .highlight .kp { 74 | color: #66d9ef; 75 | font-weight: bold; 76 | } 77 | .highlight .kr { 78 | color: #66d9ef; 79 | font-weight: bold; 80 | } 81 | .highlight .kt { 82 | color: #66d9ef; 83 | font-weight: bold; 84 | } 85 | .highlight .kn { 86 | color: #f92672; 87 | font-weight: bold; 88 | } 89 | .highlight .ow { 90 | color: #f92672; 91 | font-weight: bold; 92 | } 93 | .highlight .o { 94 | color: #f92672; 95 | font-weight: bold; 96 | } 97 | .highlight .mf { 98 | color: #ae81ff; 99 | } 100 | .highlight .mh { 101 | color: #ae81ff; 102 | } 103 | .highlight .il { 104 | color: #ae81ff; 105 | } 106 | .highlight .mi { 107 | color: #ae81ff; 108 | } 109 | .highlight .mo { 110 | color: #ae81ff; 111 | } 112 | .highlight .m, .highlight .mb, .highlight .mx { 113 | color: #ae81ff; 114 | } 115 | .highlight .se { 116 | color: #ae81ff; 117 | } 118 | .highlight .sa { 119 | color: #66d9ef; 120 | font-weight: bold; 121 | } 122 | .highlight .sb { 123 | color: #e6db74; 124 | } 125 | .highlight .sc { 126 | color: #e6db74; 127 | } 128 | .highlight .sd { 129 | color: #e6db74; 130 | } 131 | .highlight .s2 { 132 | color: #e6db74; 133 | } 134 | .highlight .sh { 135 | color: #e6db74; 136 | } 137 | .highlight .si { 138 | color: #e6db74; 139 | } 140 | .highlight .sx { 141 | color: #e6db74; 142 | } 143 | .highlight .sr { 144 | color: #e6db74; 145 | } 146 | .highlight .s1 { 147 | color: #e6db74; 148 | } 149 | .highlight .ss { 150 | color: #e6db74; 151 | } 152 | .highlight .s, .highlight .dl { 153 | color: #e6db74; 154 | } 155 | .highlight .na { 156 | color: #a6e22e; 157 | } 158 | .highlight .nc { 159 | color: #a6e22e; 160 | font-weight: bold; 161 | } 162 | .highlight .nd { 163 | color: #a6e22e; 164 | font-weight: bold; 165 | } 166 | .highlight .ne { 167 | color: #a6e22e; 168 | font-weight: bold; 169 | } 170 | .highlight .nf, .highlight .fm { 171 | color: #a6e22e; 172 | font-weight: bold; 173 | } 174 | .highlight .no { 175 | color: #66d9ef; 176 | } 177 | .highlight .bp { 178 | color: #f8f8f2; 179 | } 180 | .highlight .nb { 181 | color: #f8f8f2; 182 | } 183 | .highlight .ni { 184 | color: #f8f8f2; 185 | } 186 | .highlight .nn { 187 | color: #f8f8f2; 188 | } 189 | .highlight .vc { 190 | color: #f8f8f2; 191 | } 192 | .highlight .vg { 193 | color: #f8f8f2; 194 | } 195 | .highlight .vi { 196 | color: #f8f8f2; 197 | } 198 | .highlight .nv, .highlight .vm { 199 | color: #f8f8f2; 200 | } 201 | .highlight .w { 202 | color: #f8f8f2; 203 | } 204 | .highlight .nl { 205 | color: #f8f8f2; 206 | font-weight: bold; 207 | } 208 | .highlight .nt { 209 | color: #f92672; 210 | } 211 | .highlight { 212 | color: #f8f8f2; 213 | background-color: #49483e; 214 | } 215 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-sharing/buttons.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | var SITES = { 3 | 'facebook': { 4 | 'label': 'Facebook', 5 | 'icon': 'fa fa-facebook', 6 | 'onClick': function(e) { 7 | e.preventDefault(); 8 | window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href)); 9 | } 10 | }, 11 | 'twitter': { 12 | 'label': 'Twitter', 13 | 'icon': 'fa fa-twitter', 14 | 'onClick': function(e) { 15 | e.preventDefault(); 16 | window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href)); 17 | } 18 | }, 19 | 'github': { 20 | 'label': 'Github', 21 | 'icon': 'fa fa-github', 22 | 'onClick': function(e) { 23 | e.preventDefault(); 24 | window.open('https://github.com'); 25 | } 26 | }, 27 | 'telegram': { 28 | 'label': 'Telegram', 29 | 'icon': 'fa fa-telegram', 30 | 'onClick': function(e) { 31 | e.preventDefault(); 32 | window.open('https://t.me'); 33 | } 34 | }, 35 | 'google': { 36 | 'label': 'Google+', 37 | 'icon': 'fa fa-google-plus', 38 | 'onClick': function(e) { 39 | e.preventDefault(); 40 | window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href)); 41 | } 42 | }, 43 | 'weibo': { 44 | 'label': 'Weibo', 45 | 'icon': 'fa fa-weibo', 46 | 'onClick': function(e) { 47 | e.preventDefault(); 48 | window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)); 49 | } 50 | }, 51 | 'instapaper': { 52 | 'label': 'Instapaper', 53 | 'icon': 'fa fa-instapaper', 54 | 'onClick': function(e) { 55 | e.preventDefault(); 56 | window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href)); 57 | } 58 | }, 59 | 'vk': { 60 | 'label': 'VK', 61 | 'icon': 'fa fa-vk', 62 | 'onClick': function(e) { 63 | e.preventDefault(); 64 | window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href)); 65 | } 66 | } 67 | }; 68 | 69 | 70 | 71 | gitbook.events.bind('start', function(e, config) { 72 | var opts = config.sharing; 73 | 74 | // Create dropdown menu 75 | var menu = $.map(opts.all, function(id) { 76 | var site = SITES[id]; 77 | 78 | return { 79 | text: site.label, 80 | onClick: site.onClick 81 | }; 82 | }); 83 | 84 | // Create main button with dropdown 85 | if (menu.length > 0) { 86 | gitbook.toolbar.createButton({ 87 | icon: 'fa fa-share-alt', 88 | label: 'Share', 89 | position: 'right', 90 | dropdown: [menu] 91 | }); 92 | } 93 | 94 | // Direct actions to share 95 | $.each(SITES, function(sideId, site) { 96 | if (!opts[sideId]) return; 97 | 98 | var onClick = site.onClick; 99 | 100 | if (siteId === "github" && opts["github_link"] !== undefined && opts["github_link"] !== "") { 101 | onClick = function(e) { 102 | e.preventDefault(); 103 | window.open(opts["github_link"]); 104 | } 105 | } 106 | if (siteId === "telegram" && opts["telegram_link"] !== undefined && opts["telegram_link"] !== "") { 107 | onClick = function(e) { 108 | e.preventDefault(); 109 | window.open(opts["telegram_link"]); 110 | } 111 | } 112 | 113 | gitbook.toolbar.createButton({ 114 | icon: site.icon, 115 | label: site.text, 116 | position: 'right', 117 | onClick: onClick 118 | }); 119 | }); 120 | }); 121 | }); 122 | -------------------------------------------------------------------------------- /assets/gitbook/custom.css: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | .book-body { 5 | overflow-y: scroll; 6 | } 7 | 8 | .book-body .book-header { 9 | position: fixed; 10 | width: 100%; 11 | } 12 | 13 | .book.with-summary .book-body .book-header { 14 | position: fixed; 15 | width: calc(100% - 300px); 16 | } 17 | 18 | .book-body .body-inner { 19 | /* position: absolute; */ 20 | margin-top: 50px; 21 | min-height: calc(100% - 50px); 22 | } 23 | 24 | .book-body .body-inner .page-wrapper { 25 | min-height: calc(100% - 46px); 26 | } 27 | 28 | .book-body .body-inner .page-wrapper .page-inner { 29 | padding-bottom: 20px; 30 | } 31 | 32 | @media (max-width: 1240px) { 33 | .book-body .body-inner .navigation { 34 | max-width: calc(50% - 3px); 35 | width: calc(50% - 3px); 36 | } 37 | } 38 | 39 | .book .book-body .book-header { 40 | background: #ffffff; 41 | } 42 | 43 | .book.color-theme-1 .book-body .book-header { 44 | background: #f3eacb; 45 | } 46 | 47 | .book.color-theme-2 .book-body .book-header { 48 | background: #1c1f2b; 49 | } 50 | 51 | .page-inner { 52 | max-width: {{ site.page_width | default: '800px' }}; 53 | } 54 | 55 | .back-to-top { 56 | right: calc((100% - 300px - min(100% - 300px, {{ site.page_width | default: '800px' }})) / 2 + 25px); 57 | } 58 | 59 | /* scrollbar */ 60 | ::-webkit-scrollbar { 61 | width: 5px; 62 | height: 5px; 63 | } 64 | 65 | ::-webkit-scrollbar-track-piece { 66 | /* background-color: rgba(125, 125, 125, 0.2); */ 67 | -webkit-border-radius: 6px; 68 | } 69 | 70 | ::-webkit-scrollbar-thumb:vertical { 71 | height: 5px; 72 | background-color: rgba(7, 17, 27, .2); 73 | -webkit-border-radius: 6px; 74 | } 75 | 76 | ::-webkit-scrollbar-thumb:horizontal { 77 | width: 5px; 78 | background-color: rgba(125, 125, 125, 0.2); 79 | -webkit-border-radius: 6px; 80 | } 81 | 82 | /* Style for search page on mobile screens */ 83 | 84 | #book-search-input-link { 85 | padding: 6px; 86 | background: 0 0; 87 | background: inherit; 88 | transition: top .5s ease; 89 | border-bottom: 1px solid rgba(0,0,0,.07); 90 | border-top: 1px solid rgba(0,0,0,.07); 91 | margin-bottom: 10px; 92 | margin-top: -1px; 93 | } 94 | 95 | #book-search-input-link a { 96 | width: 100%; 97 | background: 0 0; 98 | border: 1px solid transparent; 99 | box-shadow: none; 100 | outline: 0; 101 | line-height: 38px; 102 | padding: 7px 7px; 103 | color: #757575; 104 | } 105 | 106 | #book-search-input { 107 | display: block; 108 | } 109 | #book-search-input-link { 110 | display: none; 111 | } 112 | 113 | @media (max-width: 1240px) { 114 | #book-search-input { 115 | display: none; 116 | } 117 | #book-search-input-link { 118 | display: block; 119 | } 120 | } 121 | 122 | #book-search-input-inside { 123 | padding: 6px; 124 | background: 0 0; 125 | transition: top .5s ease; 126 | background: #fff; 127 | border-bottom: 1px solid rgba(0,0,0,.07); 128 | border-top: 1px solid rgba(0,0,0,.07); 129 | margin-bottom: 10px; 130 | margin-top: -1px; 131 | } 132 | 133 | #book-search-input-inside input { 134 | width: 100%; 135 | background: 0 0; 136 | border: 1px solid transparent; 137 | box-shadow: none; 138 | outline: 0; 139 | line-height: 22px; 140 | padding: 7px 7px; 141 | color: inherit; 142 | } 143 | 144 | 145 | /* Custom font settings */ 146 | 147 | .book.font-family-0 { 148 | font-family: Georgia, serif; 149 | } 150 | .book.font-family-1 { 151 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 152 | } 153 | 154 | /* Render wide tables */ 155 | 156 | .table-wrapper { 157 | overflow-x: scroll; 158 | } 159 | 160 | /* Tips, warnings, and dangers */ 161 | 162 | .markdown-section blockquote.block-tip { 163 | border-color: var(--c-tip); 164 | background-color: var(--c-tip-bg); 165 | color: var(--c-tip-text); 166 | font-family: var(--font-family); 167 | } 168 | 169 | .markdown-section blockquote.block-tip h1 { 170 | color: var(--c-tip-title); 171 | } 172 | 173 | .markdown-section blockquote.block-tip h2 { 174 | color: var(--c-tip-title); 175 | } 176 | 177 | .markdown-section blockquote.block-tip h3 { 178 | color: var(--c-tip-title); 179 | } 180 | 181 | .markdown-section blockquote.block-tip h4 { 182 | color: var(--c-tip-title); 183 | } 184 | 185 | .markdown-section blockquote.block-tip h5 { 186 | color: var(--c-tip-title); 187 | } 188 | 189 | .markdown-section blockquote.block-tip h6 { 190 | color: var(--c-tip-title); 191 | } 192 | 193 | .markdown-section blockquote.block-warning { 194 | border-color: var(--c-warning); 195 | background-color: var(--c-warning-bg); 196 | color: var(--c-warning-text); 197 | font-family: var(--font-family); 198 | } 199 | 200 | .markdown-section blockquote.block-warning h1 { 201 | color: var(--c-warning-title); 202 | } 203 | 204 | .markdown-section blockquote.block-warning h2 { 205 | color: var(--c-warning-title); 206 | } 207 | 208 | .markdown-section blockquote.block-warning h3 { 209 | color: var(--c-warning-title); 210 | } 211 | 212 | .markdown-section blockquote.block-warning h4 { 213 | color: var(--c-warning-title); 214 | } 215 | 216 | .markdown-section blockquote.block-warning h5 { 217 | color: var(--c-warning-title); 218 | } 219 | 220 | .markdown-section blockquote.block-warning h6 { 221 | color: var(--c-warning-title); 222 | } 223 | 224 | .markdown-section blockquote.block-danger { 225 | border-color: var(--c-danger); 226 | background-color: var(--c-danger-bg); 227 | color: var(--c-danger-text); 228 | font-family: var(--font-family); 229 | } 230 | 231 | .markdown-section blockquote.block-danger h1 { 232 | color: var(--c-danger-title); 233 | } 234 | 235 | .markdown-section blockquote.block-danger h2 { 236 | color: var(--c-danger-title); 237 | } 238 | 239 | .markdown-section blockquote.block-danger h3 { 240 | color: var(--c-danger-title); 241 | } 242 | 243 | .markdown-section blockquote.block-danger h4 { 244 | color: var(--c-danger-title); 245 | } 246 | 247 | .markdown-section blockquote.block-danger h5 { 248 | color: var(--c-danger-title); 249 | } 250 | 251 | .markdown-section blockquote.block-danger h6 { 252 | color: var(--c-danger-title); 253 | } 254 | 255 | :root { 256 | --c-tip: #42b983; 257 | --c-tip-bg: #e2f5ec; 258 | --c-tip-text: #215d42; 259 | --c-tip-title: #359469; 260 | --c-warning: #e7c000; 261 | --c-warning-bg: rgba(255, 229, 100, .25); 262 | --c-warning-text: #6b5900; 263 | --c-warning-title: #b29400; 264 | --c-danger: #c00; 265 | --c-danger-bg: #ffe0e0; 266 | --c-danger-text: #600; 267 | --c-danger-title: #c00; 268 | --font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; 269 | } 270 | -------------------------------------------------------------------------------- /_layouts/chapter.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | {% include build-chapter-nav.html %} 6 | 7 | {% if page_chapter_is_draft %} 8 |
    9 | This chapter is a 10 | draft. 11 | See the outline. 12 |
    13 | {% endif %} 14 | 15 | 77 | {% if page_chapter_is_part_index %} 78 | 79 | {% if page_part_num or page_part_label %} 80 |

    81 | {{ page_part_label | escape }} 82 |

    83 | {% endif %} 84 | {% else %} 85 | {% if page.title %} 86 |

    {{ page.title | escape }}

    90 | {% endif %} 91 | {% endif %} 92 | 93 |
    94 | 95 | {% if page.abstract %} 96 |
    97 | {{ page.abstract }} 98 |
    99 | {% endif %} 100 | 101 | {% if site.in_chapter_toc.enabled and page.disable_toc != true and page_chapter_is_part_index != true %} 102 | {% capture in_chapter_toc %} 103 | {% include toc.html html=content h_min=site.sidebar_toc.h_min h_max=site.sidebar_toc.h_max %}{% endcapture %} 104 | {% capture in_chapter_toc %}{{ in_chapter_toc | strip }}{% endcapture %} 105 | 106 | {% if in_chapter_toc and in_chapter_toc != "" %} 107 |
    108 |
    109 | In this chapter: 110 | {{ in_chapter_toc }} 111 |
    112 |
    113 | {% endif %} 114 | {% endif %} 115 | 116 | {{ content }} 117 | 118 | {% comment %}{% include chapter-iterate-vars.html inspect="page" %}{% endcomment %} 119 |
    120 | 121 | {% if page_prev_chapter or page_next_chapter %} 122 | 196 | 197 | {% endif %} 198 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-search/search.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | var MAX_RESULTS = 15; 6 | var MAX_DESCRIPTION_SIZE = 500; 7 | 8 | var usePushState = (typeof history.pushState !== 'undefined'); 9 | 10 | // DOM Elements 11 | var $body = $('body'); 12 | var $bookSearchResults; 13 | var $searchInput; 14 | var $searchList; 15 | var $searchTitle; 16 | var $searchResultsCount; 17 | var $searchQuery; 18 | 19 | // Throttle search 20 | function throttle(fn, wait) { 21 | var timeout; 22 | 23 | return function() { 24 | var ctx = this, args = arguments; 25 | if (!timeout) { 26 | timeout = setTimeout(function() { 27 | timeout = null; 28 | fn.apply(ctx, args); 29 | }, wait); 30 | } 31 | }; 32 | } 33 | 34 | function displayResults(res) { 35 | $bookSearchResults.addClass('open'); 36 | 37 | var noResults = res.count == 0; 38 | $bookSearchResults.toggleClass('no-results', noResults); 39 | 40 | // Clear old results 41 | $searchList.empty(); 42 | 43 | // Display title for research 44 | $searchResultsCount.text(res.count); 45 | $searchQuery.text(res.query); 46 | 47 | // Create an
  • element for each result 48 | res.results.forEach(function(res) { 49 | var $li = $('
  • ', { 50 | 'class': 'search-results-item' 51 | }); 52 | 53 | var $title = $('

    '); 54 | 55 | var $link = $('', { 56 | 'href': gitbook.state.basePath + '/' + res.url, 57 | 'text': res.title 58 | }); 59 | 60 | var content = res.body.trim(); 61 | if (content.length > MAX_DESCRIPTION_SIZE) { 62 | content = content.slice(0, MAX_DESCRIPTION_SIZE).trim()+'...'; 63 | } 64 | var $content = $('

    ').html(content); 65 | 66 | $link.appendTo($title); 67 | $title.appendTo($li); 68 | $content.appendTo($li); 69 | $li.appendTo($searchList); 70 | }); 71 | } 72 | 73 | function launchSearch(q) { 74 | // Add class for loading 75 | $body.addClass('with-search'); 76 | $body.addClass('search-loading'); 77 | 78 | // Launch search query 79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS) 80 | .then(function(results) { 81 | displayResults(results); 82 | }) 83 | .always(function() { 84 | $body.removeClass('search-loading'); 85 | }), 1000); 86 | } 87 | 88 | function closeSearch() { 89 | $body.removeClass('with-search'); 90 | $bookSearchResults.removeClass('open'); 91 | } 92 | 93 | function launchSearchFromQueryString() { 94 | var q = getParameterByName('q'); 95 | if (q && q.length > 0) { 96 | // Update search input 97 | $searchInput.val(q); 98 | 99 | // Launch search 100 | launchSearch(q); 101 | } 102 | } 103 | 104 | function bindSearch() { 105 | // Bind DOM 106 | $searchInput = $('#book-search-input input'); 107 | $bookSearchResults = $('#book-search-results'); 108 | $searchList = $bookSearchResults.find('.search-results-list'); 109 | $searchTitle = $bookSearchResults.find('.search-results-title'); 110 | $searchResultsCount = $searchTitle.find('.search-results-count'); 111 | $searchQuery = $searchTitle.find('.search-query'); 112 | 113 | // Launch query based on input content 114 | function handleUpdate() { 115 | var q = $searchInput.val(); 116 | 117 | if (q.length == 0) { 118 | closeSearch(); 119 | } 120 | else { 121 | launchSearch(q); 122 | } 123 | } 124 | 125 | // Detect true content change in search input 126 | // Workaround for IE < 9 127 | var propertyChangeUnbound = false; 128 | $searchInput.on('propertychange', function(e) { 129 | if (e.originalEvent.propertyName == 'value') { 130 | handleUpdate(); 131 | } 132 | }); 133 | 134 | // HTML5 (IE9 & others) 135 | $searchInput.on('input', function(e) { 136 | // Unbind propertychange event for IE9+ 137 | if (!propertyChangeUnbound) { 138 | $(this).unbind('propertychange'); 139 | propertyChangeUnbound = true; 140 | } 141 | 142 | handleUpdate(); 143 | }); 144 | 145 | // Push to history on blur 146 | $searchInput.on('blur', function(e) { 147 | // Update history state 148 | if (usePushState) { 149 | var uri = updateQueryString('q', $(this).val()); 150 | history.pushState({ path: uri }, null, uri); 151 | } 152 | }); 153 | } 154 | 155 | gitbook.events.on('page.change', function() { 156 | bindSearch(); 157 | closeSearch(); 158 | 159 | // Launch search based on query parameter 160 | if (gitbook.search.isInitialized()) { 161 | launchSearchFromQueryString(); 162 | } 163 | }); 164 | 165 | gitbook.events.on('search.ready', function() { 166 | bindSearch(); 167 | 168 | // Launch search from query param at start 169 | launchSearchFromQueryString(); 170 | }); 171 | 172 | function getParameterByName(name) { 173 | var url = window.location.href; 174 | name = name.replace(/[\[\]]/g, '\\$&'); 175 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'), 176 | results = regex.exec(url); 177 | if (!results) return null; 178 | if (!results[2]) return ''; 179 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 180 | } 181 | 182 | function updateQueryString(key, value) { 183 | value = encodeURIComponent(value); 184 | 185 | var url = window.location.href; 186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), 187 | hash; 188 | 189 | if (re.test(url)) { 190 | if (typeof value !== 'undefined' && value !== null) 191 | return url.replace(re, '$1' + key + '=' + value + '$2$3'); 192 | else { 193 | hash = url.split('#'); 194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); 195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 196 | url += '#' + hash[1]; 197 | return url; 198 | } 199 | } 200 | else { 201 | if (typeof value !== 'undefined' && value !== null) { 202 | var separator = url.indexOf('?') !== -1 ? '&' : '?'; 203 | hash = url.split('#'); 204 | url = hash[0] + separator + key + '=' + value; 205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 206 | url += '#' + hash[1]; 207 | return url; 208 | } 209 | else 210 | return url; 211 | } 212 | } 213 | }); 214 | -------------------------------------------------------------------------------- /_includes/chapter-vars.html: -------------------------------------------------------------------------------- 1 | {% assign chapter = nil %} 2 | {% assign chapter_is_draft = nil %} 3 | {% assign chapter_is_visible = nil %} 4 | {% assign chapter_sort_index = nil %} 5 | {% assign chapter_sort_index_ext = nil %} 6 | {% assign chapter_is_part_index = nil %} 7 | {% assign part_label = nil %} 8 | {% assign part_unnumbered = nil %} 9 | {% assign part_is_draft = nil %} 10 | {% assign part_folder = nil %} 11 | {% assign part_sort_index = nil %} 12 | {% assign part_sort_index_ext = nil %} 13 | {% assign part_index_chapter = nil %} 14 | 15 | {% comment %} Only set if specified via include.withnum: {% endcomment %} 16 | {% assign chapter_num = nil %} 17 | {% assign part_num = nil %} 18 | 19 | {% if include.id %} 20 | {% assign chapter = site.chapters | where: "id", include.id | first %} 21 | {% elsif include.slug %} 22 | {% assign chapter = site.chapters | where: "slug", include.slug | first %} 23 | {% elsif include.idx %} 24 | {% assign chapter = site.chapters[include.idx] %} 25 | {% endif %} 26 | 27 | {% if chapter %} 28 | {% assign chapter_is_draft = false %} 29 | {% assign chapter_is_visible = true %} 30 | {% assign chapter_basename = chapter.path | split: "/" | last %} 31 | {% assign chapter_sort_index = chapter_basename | split: "-" | first %} 32 | {% assign chapter_sort_index_ext = nil %} 33 | {% assign chapter_is_part_index = false %} 34 | 35 | {% if chapter_basename == "000-index.md" %} 36 | {% assign chapter_is_part_index = true %} 37 | {% endif %} 38 | 39 | {% unless chapter_is_part_index %} 40 | {% if chapter_sort_index contains "." %} 41 | {% assign chapter_sort_index_ext = chapter_sort_index | split: "." | last %} 42 | {% endif %} 43 | {% endunless %} 44 | 45 | {% if chapter_sort_index_ext == "draft" %} 46 | {% assign chapter_is_draft = true %} 47 | {% unless jekyll.environment == "development" and site.show_drafts_in_dev %} 48 | {% assign chapter_is_visible = false %} 49 | {% endunless %} 50 | {% endif %} 51 | 52 | {% assign part_folder = chapter.path | split: "/" | slice: -2 | first %} 53 | {% if part_folder == "_chapters" %} 54 | {% assign part_folder = nil %} 55 | {% endif %} 56 | {% if part_folder %} 57 | {% assign part_sort_index = part_folder | split: "-" | first %} 58 | {% if part_sort_index contains "." %} 59 | {% assign part_sort_index_ext = part_sort_index | split: "." | last %} 60 | {% else %} 61 | {% assign part_sort_index_ext = nil %} 62 | {% endif %} 63 | 64 | {% capture part_index_path %}_chapters/{{ part_folder}}/000-index.md{% endcapture %} 65 | {% assign part_index_chapter = site.chapters | where: "path", part_index_path | first %} 66 | 67 | {% if part_sort_index_ext == "draft" %} 68 | {% assign part_is_draft = true %} 69 | {% else %} 70 | {% assign part_is_draft = false %} 71 | {% endif %} 72 | 73 | {% if part_sort_index == "000" or part_sort_index == "999" %} 74 | {% assign part_unnumbered = true %} 75 | {% assign part_label = nil %} 76 | {% else %} 77 | {% assign part_unnumbered = false %} 78 | {% assign part_label = part_folder | split: "-" | shift | join: " " | capitalize %} 79 | {% endif %} 80 | {% endif %} 81 | 82 | {% comment %} Get part and chapter numbers {% endcomment %} 83 | {% if include.withnum %} 84 | {% unless part_unnumbered %} 85 | {% if include.withnum == "chapter" and chapter_is_draft %} 86 | {% assign chapter_num = "X" %} 87 | {% elsif include.withnum == "chapter" and chapter_is_visible != true %} 88 | {% assign chapter_num = "" %} 89 | {% elsif include.withnum == "chapter" and chapter_is_part_index %} 90 | {% assign chapter_num = "" %} 91 | {% elsif include.withnum == "part" and part_is_draft %} 92 | {% assign part_num = "X" %} 93 | {% elsif part_is_draft and chapter_is_draft %} 94 | {% assign part_num = "X" %} 95 | {% assign chapter_num = "X" %} 96 | {% else %} 97 | {% comment %} Iterate over chapters if it can't be avoided {% endcomment %} 98 | {% include chapter-iterate-init.html %} 99 | {% for i in (0..site.chapters.size) %} 100 | {% if chapter.id == i_chapter.id %} 101 | {% assign chapter_num = i_chapter_num %} 102 | {% assign part_num = i_part_num %} 103 | {% else %} 104 | {% include chapter-iterate-next.html %} 105 | {% endif %} 106 | {% endfor %} 107 | {% endif %} 108 | {% endunless %} 109 | {% endif %} 110 | {% endif %} 111 | 112 | {% if include.inspect %} 113 | 114 | 115 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 140 | 141 | 142 | 143 | 145 | 146 | 147 | 148 | 150 | 151 | 152 | 153 | 154 | 159 | 160 | 161 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 |
    116 | chapter inherits from page 117 |
    118 | The 119 | chapter 120 | object is identical to the 121 | built-in Jekyll 122 | page 123 | 124 | object with the same 125 | id. 126 |
    127 |
    page.id{{ page.id }}
    chapter.id{{ chapter.id }}
    chapter.title 139 | {{ chapter.title }}
    chapter.slug 144 | {{ chapter.slug }}
    chapter.url 149 | {{ chapter.url }}
    ...See 155 | 156 | page 157 | documentation 158 |
    162 | Chapter metadata 163 |
    chapter_is_draft{{ chapter_is_draft }}
    chapter_is_visible{{ chapter_is_visible }}
    chapter_is_part_index{{ chapter_is_part_index }}
    chapter_sort_index{{ chapter_sort_index }}
    chapter_sort_index_ext{{ chapter_sort_index_ext }}
    187 | Part metadata 188 |
    part_label{{ part_label }}
    part_unnumbered{{ part_unnumbered }}
    part_is_draft{{ part_is_draft }}
    part_folder{{ part_folder }}
    part_sort_index{{ part_sort_index }}
    part_sort_index_ext{{ part_sort_index_ext }}
    part_index_chapter.url{{ part_index_chapter.url }}
    220 | Numbering 221 |
    chapter_num{{ chapter_num }}
    part_num{{ part_num }}
    232 | {% endif %} -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-fontsettings/fontsettings.js: -------------------------------------------------------------------------------- 1 | require(['gitbook', 'jquery'], function(gitbook, $) { 2 | // Configuration 3 | var MAX_SIZE = 4, 4 | MIN_SIZE = 0, 5 | BUTTON_ID; 6 | 7 | // Current fontsettings state 8 | var fontState; 9 | 10 | // Default themes 11 | var THEMES = [ 12 | { 13 | config: 'white', 14 | text: 'White', 15 | id: 0 16 | }, 17 | { 18 | config: 'sepia', 19 | text: 'Sepia', 20 | id: 1 21 | }, 22 | { 23 | config: 'night', 24 | text: 'Night', 25 | id: 2 26 | } 27 | ]; 28 | 29 | // Default font families 30 | var FAMILIES = [ 31 | { 32 | config: 'serif', 33 | text: 'Serif', 34 | id: 0 35 | }, 36 | { 37 | config: 'sans', 38 | text: 'Sans', 39 | id: 1 40 | } 41 | ]; 42 | 43 | // Return configured themes 44 | function getThemes() { 45 | return THEMES; 46 | } 47 | 48 | // Modify configured themes 49 | function setThemes(themes) { 50 | THEMES = themes; 51 | updateButtons(); 52 | } 53 | 54 | // Return configured font families 55 | function getFamilies() { 56 | return FAMILIES; 57 | } 58 | 59 | // Modify configured font families 60 | function setFamilies(families) { 61 | FAMILIES = families; 62 | updateButtons(); 63 | } 64 | 65 | // Save current font settings 66 | function saveFontSettings() { 67 | gitbook.storage.set('fontState', fontState); 68 | update(); 69 | } 70 | 71 | // Increase font size 72 | function enlargeFontSize(e) { 73 | e.preventDefault(); 74 | if (fontState.size >= MAX_SIZE) return; 75 | 76 | fontState.size++; 77 | saveFontSettings(); 78 | } 79 | 80 | // Decrease font size 81 | function reduceFontSize(e) { 82 | e.preventDefault(); 83 | if (fontState.size <= MIN_SIZE) return; 84 | 85 | fontState.size--; 86 | saveFontSettings(); 87 | } 88 | 89 | // Change font family 90 | function changeFontFamily(configName, e) { 91 | if (e && e instanceof Event) { 92 | e.preventDefault(); 93 | } 94 | 95 | var familyId = getFontFamilyId(configName); 96 | fontState.family = familyId; 97 | saveFontSettings(); 98 | } 99 | 100 | // Change type of color theme 101 | function changeColorTheme(configName, e) { 102 | if (e && e instanceof Event) { 103 | e.preventDefault(); 104 | } 105 | 106 | var $book = gitbook.state.$book; 107 | var $header = $('.book-body > .book-header'); 108 | 109 | // Remove currently applied color theme 110 | if (fontState.theme !== 0) { 111 | $book.removeClass('color-theme-'+fontState.theme); 112 | if ($header.length !== 0) { 113 | $header.removeClass('color-theme-'+fontState.theme); 114 | } 115 | } 116 | 117 | // Set new color theme 118 | var themeId = getThemeId(configName); 119 | fontState.theme = themeId; 120 | if (fontState.theme !== 0) { 121 | $book.addClass('color-theme-'+fontState.theme); 122 | if ($header.length !== 0) { 123 | $header.addClass('color-theme-'+fontState.theme); 124 | } 125 | } 126 | 127 | saveFontSettings(); 128 | } 129 | 130 | // Return the correct id for a font-family config key 131 | // Default to first font-family 132 | function getFontFamilyId(configName) { 133 | // Search for plugin configured font family 134 | var configFamily = $.grep(FAMILIES, function(family) { 135 | return family.config == configName; 136 | })[0]; 137 | // Fallback to default font family 138 | return (!!configFamily)? configFamily.id : 0; 139 | } 140 | 141 | // Return the correct id for a theme config key 142 | // Default to first theme 143 | function getThemeId(configName) { 144 | // Search for plugin configured theme 145 | var configTheme = $.grep(THEMES, function(theme) { 146 | return theme.config == configName; 147 | })[0]; 148 | // Fallback to default theme 149 | return (!!configTheme)? configTheme.id : 0; 150 | } 151 | 152 | function update() { 153 | var $book = gitbook.state.$book; 154 | 155 | $('.font-settings .font-family-list li').removeClass('active'); 156 | $('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active'); 157 | 158 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); 159 | $book.addClass('font-size-'+fontState.size); 160 | $book.addClass('font-family-'+fontState.family); 161 | 162 | if(fontState.theme !== 0) { 163 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); 164 | $book.addClass('color-theme-'+fontState.theme); 165 | } 166 | } 167 | 168 | function init(config) { 169 | // Search for plugin configured font family 170 | var configFamily = getFontFamilyId(config.family), 171 | configTheme = getThemeId(config.theme); 172 | 173 | // Instantiate font state object 174 | fontState = gitbook.storage.get('fontState', { 175 | size: config.size || 2, 176 | family: configFamily, 177 | theme: configTheme 178 | }); 179 | 180 | update(); 181 | } 182 | 183 | function updateButtons() { 184 | // Remove existing fontsettings buttons 185 | if (!!BUTTON_ID) { 186 | gitbook.toolbar.removeButton(BUTTON_ID); 187 | } 188 | 189 | // Create buttons in toolbar 190 | BUTTON_ID = gitbook.toolbar.createButton({ 191 | icon: 'fa fa-font', 192 | label: 'Font Settings', 193 | className: 'font-settings', 194 | // position: 'right', // JG 195 | dropdown: [ 196 | [ 197 | { 198 | text: 'A', 199 | className: 'font-reduce', 200 | onClick: reduceFontSize 201 | }, 202 | { 203 | text: 'A', 204 | className: 'font-enlarge', 205 | onClick: enlargeFontSize 206 | } 207 | ], 208 | $.map(FAMILIES, function(family) { 209 | family.onClick = function(e) { 210 | return changeFontFamily(family.config, e); 211 | }; 212 | 213 | return family; 214 | }), 215 | $.map(THEMES, function(theme) { 216 | theme.onClick = function(e) { 217 | return changeColorTheme(theme.config, e); 218 | }; 219 | 220 | return theme; 221 | }) 222 | ] 223 | }); 224 | } 225 | 226 | // Init configuration at start 227 | gitbook.events.bind('start', function(e, config) { 228 | var opts = config.fontsettings; 229 | 230 | // Generate buttons at start 231 | updateButtons(); 232 | 233 | // Init current settings 234 | init(opts); 235 | }); 236 | 237 | // Expose API 238 | gitbook.fontsettings = { 239 | enlargeFontSize: enlargeFontSize, 240 | reduceFontSize: reduceFontSize, 241 | setTheme: changeColorTheme, 242 | setFamily: changeFontFamily, 243 | getThemes: getThemes, 244 | setThemes: setThemes, 245 | getFamilies: getFamilies, 246 | setFamilies: setFamilies 247 | }; 248 | }); 249 | -------------------------------------------------------------------------------- /_includes/toc.html: -------------------------------------------------------------------------------- 1 | {% capture tocWorkspace %} 2 | {% comment %} 3 | Copyright (c) 2017 Vladimir "allejo" Jimenez 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | {% endcomment %} 26 | {% comment %} 27 | Version 1.1.0 28 | https://github.com/allejo/jekyll-toc 29 | 30 | "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe 31 | 32 | Usage: 33 | {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} 34 | 35 | Parameters: 36 | * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll 37 | 38 | Optional Parameters: 39 | * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC 40 | * class (string) : '' - a CSS class assigned to the TOC 41 | * id (string) : '' - an ID to assigned to the TOC 42 | * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored 43 | * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored 44 | * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list 45 | * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level 46 | * submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level 47 | * base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content 48 | * anchor_class (string) : '' - add custom class(es) for each anchor element 49 | * skip_no_ids (bool) : false - skip headers that do not have an `id` attribute 50 | 51 | Output: 52 | An ordered or unordered list representing the table of contents of a markdown block. This snippet will only 53 | generate the table of contents and will NOT output the markdown given to it 54 | {% endcomment %} 55 | 56 | {% capture newline %} 57 | {% endcapture %} 58 | {% assign newline = newline | rstrip %} 59 | 60 | {% capture deprecation_warnings %}{% endcapture %} 61 | 62 | {% if include.baseurl %} 63 | {% capture deprecation_warnings %}{{ deprecation_warnings }}{{ newline }}{% endcapture %} 64 | {% endif %} 65 | 66 | {% if include.skipNoIDs %} 67 | {% capture deprecation_warnings %}{{ deprecation_warnings }}{{ newline }}{% endcapture %} 68 | {% endif %} 69 | 70 | {% capture jekyll_toc %}{% endcapture %} 71 | {% assign orderedList = include.ordered | default: false %} 72 | {% assign baseURL = include.base_url | default: include.baseurl | default: '' %} 73 | {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %} 74 | {% assign minHeader = include.h_min | default: 1 %} 75 | {% assign maxHeader = include.h_max | default: 6 %} 76 | {% assign nodes = include.html | strip | split: ' maxHeader %} 92 | {% continue %} 93 | {% endif %} 94 | 95 | {% assign _workspace = node | split: '' | first }}>{% endcapture %} 114 | {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} 115 | 116 | {% if include.item_class and include.item_class != blank %} 117 | {% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %} 118 | {% endif %} 119 | 120 | {% if include.submenu_class and include.submenu_class != blank %} 121 | {% assign subMenuLevel = currLevel | minus: 1 %} 122 | {% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %} 123 | {% endif %} 124 | 125 | {% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %} 126 | 127 | {% if htmlID %} 128 | {% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %} 129 | 130 | {% if include.anchor_class %} 131 | {% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %} 132 | {% endif %} 133 | 134 | {% capture listItem %}{{ anchorBody }}
    {% endcapture %} 135 | {% elsif skipNoIDs == true %} 136 | {% continue %} 137 | {% else %} 138 | {% capture listItem %}{{ anchorBody }}{% endcapture %} 139 | {% endif %} 140 | 141 | {% if currLevel > lastLevel %} 142 | {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %} 143 | {% elsif currLevel < lastLevel %} 144 | {% assign repeatCount = lastLevel | minus: currLevel %} 145 | 146 | {% for i in (1..repeatCount) %} 147 | {% capture jekyll_toc %}{{ jekyll_toc }}

  • {% endcapture %} 148 | {% endfor %} 149 | 150 | {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} 151 | {% else %} 152 | {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} 153 | {% endif %} 154 | 155 | {% capture jekyll_toc %}{{ jekyll_toc }}{{ listItem }}{% endcapture %} 156 | 157 | {% assign lastLevel = currLevel %} 158 | {% assign firstHeader = false %} 159 | {% endfor %} 160 | 161 | {% assign repeatCount = minHeader | minus: 1 %} 162 | {% assign repeatCount = lastLevel | minus: repeatCount %} 163 | {% for i in (1..repeatCount) %} 164 | {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} 165 | {% endfor %} 166 | 167 | {% if jekyll_toc != '' %} 168 | {% assign rootAttributes = '' %} 169 | {% if include.class and include.class != blank %} 170 | {% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %} 171 | {% endif %} 172 | 173 | {% if include.id and include.id != blank %} 174 | {% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %} 175 | {% endif %} 176 | 177 | {% if rootAttributes %} 178 | {% assign nodes = jekyll_toc | split: '>' %} 179 | {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %} 180 | {% endif %} 181 | {% endif %} 182 | {% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc }} 183 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-fontsettings/website.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Theme 1 3 | */ 4 | .color-theme-1 .dropdown-menu { 5 | background-color: #111111; 6 | border-color: #7e888b; 7 | } 8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { 9 | border-bottom: 9px solid #111111; 10 | } 11 | .color-theme-1 .dropdown-menu .buttons { 12 | border-color: #7e888b; 13 | } 14 | .color-theme-1 .dropdown-menu .button { 15 | color: #afa790; 16 | } 17 | .color-theme-1 .dropdown-menu .button:hover { 18 | color: #73553c; 19 | } 20 | /* 21 | * Theme 2 22 | */ 23 | .color-theme-2 .dropdown-menu { 24 | background-color: #2d3143; 25 | border-color: #272a3a; 26 | } 27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { 28 | border-bottom: 9px solid #2d3143; 29 | } 30 | .color-theme-2 .dropdown-menu .buttons { 31 | border-color: #272a3a; 32 | } 33 | .color-theme-2 .dropdown-menu .button { 34 | color: #62677f; 35 | } 36 | .color-theme-2 .dropdown-menu .button:hover { 37 | color: #f4f4f5; 38 | } 39 | .book .book-header .font-settings .font-enlarge { 40 | line-height: 30px; 41 | font-size: 1.4em; 42 | } 43 | .book .book-header .font-settings .font-reduce { 44 | line-height: 30px; 45 | font-size: 1em; 46 | } 47 | .book.color-theme-1 .book-body { 48 | color: #704214; 49 | background: #f3eacb; 50 | } 51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section { 52 | background: #f3eacb; 53 | } 54 | .book.color-theme-2 .book-body { 55 | color: #bdcadb; 56 | background: #1c1f2b; 57 | } 58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section { 59 | background: #1c1f2b; 60 | } 61 | .book.font-size-0 .book-body .page-inner section { 62 | font-size: 1.2rem; 63 | } 64 | .book.font-size-1 .book-body .page-inner section { 65 | font-size: 1.4rem; 66 | } 67 | .book.font-size-2 .book-body .page-inner section { 68 | font-size: 1.6rem; 69 | } 70 | .book.font-size-3 .book-body .page-inner section { 71 | font-size: 2.2rem; 72 | } 73 | .book.font-size-4 .book-body .page-inner section { 74 | font-size: 4rem; 75 | } 76 | .book.font-family-0 { 77 | font-family: Georgia, serif; 78 | } 79 | .book.font-family-1 { 80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 81 | } 82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { 83 | color: #704214; 84 | } 85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { 86 | color: inherit; 87 | } 88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, 90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, 91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, 92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, 93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 94 | color: inherit; 95 | } 96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, 97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { 98 | border-color: inherit; 99 | } 100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { 101 | color: inherit; 102 | } 103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { 104 | background-color: inherit; 105 | } 106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { 107 | border-color: inherit; 108 | } 109 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, 110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { 111 | background: #fdf6e3; 112 | color: #657b83; 113 | border-color: #f8df9c; 114 | } 115 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { 116 | background-color: inherit; 117 | } 118 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, 119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { 120 | border-color: #f5d06c; 121 | } 122 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { 123 | color: inherit; 124 | background-color: #fdf6e3; 125 | border-color: #444444; 126 | } 127 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 128 | background-color: #fbeecb; 129 | } 130 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { 131 | color: #bdcadb; 132 | } 133 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { 134 | color: #3eb1d0; 135 | } 136 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, 138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, 139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, 140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, 141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 142 | color: #fffffa; 143 | } 144 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, 145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { 146 | border-color: #373b4e; 147 | } 148 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { 149 | color: #373b4e; 150 | } 151 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { 152 | background-color: #373b4e; 153 | } 154 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { 155 | border-color: #373b4e; 156 | } 157 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, 158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { 159 | color: #9dbed8; 160 | background: #2d3143; 161 | border-color: #2d3143; 162 | } 163 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { 164 | background-color: #282a39; 165 | } 166 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, 167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { 168 | border-color: #3b3f54; 169 | } 170 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { 171 | color: #b6c2d2; 172 | background-color: #2d3143; 173 | border-color: #3b3f54; 174 | } 175 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { 176 | background-color: #35394b; 177 | } 178 | .book.color-theme-1 .book-header { 179 | color: #afa790; 180 | background: transparent; 181 | } 182 | .book.color-theme-1 .book-header .btn { 183 | color: #afa790; 184 | } 185 | .book.color-theme-1 .book-header .btn:hover { 186 | color: #73553c; 187 | background: none; 188 | } 189 | .book.color-theme-1 .book-header h1 { 190 | color: #704214; 191 | } 192 | .book.color-theme-2 .book-header { 193 | color: #7e888b; 194 | background: transparent; 195 | } 196 | .book.color-theme-2 .book-header .btn { 197 | color: #3b3f54; 198 | } 199 | .book.color-theme-2 .book-header .btn:hover { 200 | color: #fffff5; 201 | background: none; 202 | } 203 | .book.color-theme-2 .book-header h1 { 204 | color: #bdcadb; 205 | } 206 | .book.color-theme-1 .book-body .navigation { 207 | color: #afa790; 208 | } 209 | .book.color-theme-1 .book-body .navigation:hover { 210 | color: #73553c; 211 | } 212 | .book.color-theme-2 .book-body .navigation { 213 | color: #383f52; 214 | } 215 | .book.color-theme-2 .book-body .navigation:hover { 216 | color: #fffff5; 217 | } 218 | /* 219 | * Theme 1 220 | */ 221 | .book.color-theme-1 .book-summary { 222 | color: #afa790; 223 | background: #111111; 224 | border-right: 1px solid rgba(0, 0, 0, 0.07); 225 | } 226 | .book.color-theme-1 .book-summary .book-search { 227 | background: transparent; 228 | } 229 | .book.color-theme-1 .book-summary .book-search input, 230 | .book.color-theme-1 .book-summary .book-search input:focus { 231 | border: 1px solid transparent; 232 | } 233 | .book.color-theme-1 .book-summary ul.summary li.divider { 234 | background: #7e888b; 235 | box-shadow: none; 236 | } 237 | .book.color-theme-1 .book-summary ul.summary li i.fa-check { 238 | color: #33cc33; 239 | } 240 | .book.color-theme-1 .book-summary ul.summary li.done > a { 241 | color: #877f6a; 242 | } 243 | .book.color-theme-1 .book-summary ul.summary li a, 244 | .book.color-theme-1 .book-summary ul.summary li span { 245 | color: #877f6a; 246 | background: transparent; 247 | font-weight: normal; 248 | } 249 | .book.color-theme-1 .book-summary ul.summary li.active > a, 250 | .book.color-theme-1 .book-summary ul.summary li a:hover { 251 | color: #704214; 252 | background: transparent; 253 | font-weight: normal; 254 | } 255 | /* 256 | * Theme 2 257 | */ 258 | .book.color-theme-2 .book-summary { 259 | color: #bcc1d2; 260 | background: #2d3143; 261 | border-right: none; 262 | } 263 | .book.color-theme-2 .book-summary .book-search { 264 | background: transparent; 265 | } 266 | .book.color-theme-2 .book-summary .book-search input, 267 | .book.color-theme-2 .book-summary .book-search input:focus { 268 | border: 1px solid transparent; 269 | } 270 | .book.color-theme-2 .book-summary ul.summary li.divider { 271 | background: #272a3a; 272 | box-shadow: none; 273 | } 274 | .book.color-theme-2 .book-summary ul.summary li i.fa-check { 275 | color: #33cc33; 276 | } 277 | .book.color-theme-2 .book-summary ul.summary li.done > a { 278 | color: #62687f; 279 | } 280 | .book.color-theme-2 .book-summary ul.summary li a, 281 | .book.color-theme-2 .book-summary ul.summary li span { 282 | color: #c1c6d7; 283 | background: transparent; 284 | font-weight: 600; 285 | } 286 | .book.color-theme-2 .book-summary ul.summary li.active > a, 287 | .book.color-theme-2 .book-summary ul.summary li a:hover { 288 | color: #f4f4f5; 289 | background: #252737; 290 | font-weight: 600; 291 | } 292 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-search-pro/search.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | var MAX_DESCRIPTION_SIZE = 500; 6 | var state = gitbook.state; 7 | var INDEX_DATA = {}; 8 | var usePushState = (typeof history.pushState !== 'undefined'); 9 | 10 | // DOM Elements 11 | var $body = $('body'); 12 | var $bookSearchResults; 13 | var $searchList; 14 | var $searchTitle; 15 | var $searchResultsCount; 16 | var $searchQuery; 17 | 18 | // Throttle search 19 | function throttle(fn, wait) { 20 | var timeout; 21 | 22 | return function() { 23 | var ctx = this, 24 | args = arguments; 25 | if (!timeout) { 26 | timeout = setTimeout(function() { 27 | timeout = null; 28 | fn.apply(ctx, args); 29 | }, wait); 30 | } 31 | }; 32 | } 33 | 34 | function displayResults(res) { 35 | $bookSearchResults = $('#book-search-results'); 36 | $searchList = $bookSearchResults.find('.search-results-list'); 37 | $searchTitle = $bookSearchResults.find('.search-results-title'); 38 | $searchResultsCount = $searchTitle.find('.search-results-count'); 39 | $searchQuery = $searchTitle.find('.search-query'); 40 | 41 | $bookSearchResults.addClass('open'); 42 | 43 | var noResults = res.count == 0; 44 | $bookSearchResults.toggleClass('no-results', noResults); 45 | 46 | // Clear old results 47 | $searchList.empty(); 48 | 49 | // Display title for research 50 | $searchResultsCount.text(res.count); 51 | $searchQuery.text(res.query); 52 | 53 | // Create an
  • element for each result 54 | res.results.forEach(function(item) { 55 | var $li = $('
  • ', { 56 | 'class': 'search-results-item' 57 | }); 58 | 59 | var $title = $('

    '); 60 | 61 | var $link = $('', { 62 | 'href': item.url + '?h=' + encodeURIComponent(res.query), 63 | 'text': item.title, 64 | 'data-is-search': 1 65 | }); 66 | 67 | if ($link[0].href.split('?')[0] === location.href.split('?')[0]) { 68 | $link[0].setAttribute('data-need-reload', 1); 69 | } 70 | 71 | var content = item.body.trim(); 72 | if (content.length > MAX_DESCRIPTION_SIZE) { 73 | content = content + '...'; 74 | } 75 | var $content = $('

    ').html(content); 76 | 77 | $link.appendTo($title); 78 | $title.appendTo($li); 79 | $content.appendTo($li); 80 | $li.appendTo($searchList); 81 | }); 82 | $('.body-inner').scrollTop(0); 83 | } 84 | 85 | function escapeReg(keyword) { 86 | //escape regexp prevserve word 87 | return String(keyword).replace(/([\*\.\?\+\$\^\[\]\(\)\{\}\|\/\\])/g, '\\$1'); 88 | } 89 | 90 | function query(keyword) { 91 | if (keyword == null || keyword.trim() === '') return; 92 | 93 | var results = [], 94 | index = -1; 95 | for (var page in INDEX_DATA) { 96 | if ((index = INDEX_DATA[page].body.toLowerCase().indexOf(keyword.toLowerCase())) !== -1) { 97 | results.push({ 98 | url: page, 99 | title: INDEX_DATA[page].title, 100 | body: INDEX_DATA[page].body.substr(Math.max(0, index - 50), MAX_DESCRIPTION_SIZE).replace(new RegExp('(' + escapeReg(keyword) + ')', 'gi'), '$1') 101 | }); 102 | } 103 | } 104 | displayResults({ 105 | count: results.length, 106 | query: keyword, 107 | results: results 108 | }); 109 | } 110 | 111 | function launchSearch(keyword) { 112 | // Add class for loading 113 | $body.addClass('with-search'); 114 | $body.addClass('search-loading'); 115 | 116 | function doSearch() { 117 | query(keyword); 118 | $body.removeClass('search-loading'); 119 | } 120 | 121 | throttle(doSearch)(); 122 | } 123 | 124 | function closeSearch() { 125 | $body.removeClass('with-search'); 126 | $('#book-search-results').removeClass('open'); 127 | } 128 | 129 | function bindSearch(target) { 130 | // Asynchronously load the index data 131 | { 132 | var url = state.basePath + "/assets/search_plus_index.json"; 133 | $.getJSON(url).then(function(data) { 134 | INDEX_DATA = data; 135 | handleUpdate(); 136 | }); 137 | } 138 | 139 | // Bind DOM 140 | var $body = $('body'); 141 | 142 | // Launch query based on input content 143 | function handleUpdate() { 144 | var $searchInput = $(target); 145 | var keyword = $searchInput.val(); 146 | 147 | if (keyword === undefined || keyword.length == 0) { 148 | closeSearch(); 149 | } else { 150 | launchSearch(keyword); 151 | } 152 | } 153 | 154 | $body.on('keyup', target, function(e) { 155 | if (e.keyCode === 13) { 156 | if (usePushState) { 157 | var uri = updateQueryString('q', $(this).val()); 158 | history.pushState({ 159 | path: uri 160 | }, null, uri); 161 | } 162 | } 163 | handleUpdate(); 164 | }); 165 | 166 | $body.on('click', target, function(e) { 167 | if (Object.keys(INDEX_DATA).length === 0) { 168 | var url = state.basePath + "/assets/search_plus_index.json"; 169 | $.getJSON(url).then(function(data) { 170 | INDEX_DATA = data; 171 | handleUpdate(); 172 | }); 173 | } 174 | }); 175 | 176 | // Push to history on blur 177 | $body.on('blur', target, function(e) { 178 | // Update history state 179 | if (usePushState) { 180 | var uri = updateQueryString('q', $(this).val()); 181 | history.pushState({ 182 | path: uri 183 | }, null, uri); 184 | } 185 | }); 186 | } 187 | 188 | gitbook.events.on('start', function() { 189 | bindSearch('#book-search-input input'); 190 | bindSearch('#book-search-input-inside input'); 191 | 192 | showResult(); 193 | closeSearch(); 194 | }); 195 | 196 | // 高亮文本 197 | var highLightPageInner = function(keyword) { 198 | $('.page-inner').mark(keyword, { 199 | 'ignoreJoiners': true, 200 | 'acrossElements': true, 201 | 'separateWordSearch': false 202 | }); 203 | 204 | setTimeout(function() { 205 | var mark = $('mark[data-markjs="true"]'); 206 | if (mark.length) { 207 | mark[0].scrollIntoView(); 208 | } 209 | }, 100); 210 | }; 211 | 212 | function showResult() { 213 | var keyword, type; 214 | if (/\b(q|h)=([^&]+)/.test(location.search)) { 215 | type = RegExp.$1; 216 | keyword = decodeURIComponent(RegExp.$2); 217 | if (type === 'q') { 218 | launchSearch(keyword); 219 | } else { 220 | highLightPageInner(keyword); 221 | } 222 | $('#book-search-input input').val(keyword); 223 | $('#book-search-input-inside input').val(keyword); 224 | } 225 | } 226 | 227 | gitbook.events.on('page.change', showResult); 228 | 229 | function getParameterByName(name) { 230 | var url = window.location.href; 231 | name = name.replace(/[\[\]]/g, '\\$&'); 232 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'), 233 | results = regex.exec(url); 234 | if (!results) return null; 235 | if (!results[2]) return ''; 236 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 237 | } 238 | 239 | function updateQueryString(key, value) { 240 | value = encodeURIComponent(value); 241 | 242 | var url = window.location.href.replace(/([?&])(?:q|h)=([^&]+)(&|$)/, function(all, pre, value, end) { 243 | if (end === '&') { 244 | return pre; 245 | } 246 | return ''; 247 | }); 248 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), 249 | hash; 250 | 251 | if (re.test(url)) { 252 | if (typeof value !== 'undefined' && value !== null) 253 | return url.replace(re, '$1' + key + '=' + value + '$2$3'); 254 | else { 255 | hash = url.split('#'); 256 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); 257 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 258 | url += '#' + hash[1]; 259 | return url; 260 | } 261 | } else { 262 | if (typeof value !== 'undefined' && value !== null) { 263 | var separator = url.indexOf('?') !== -1 ? '&' : '?'; 264 | hash = url.split('#'); 265 | url = hash[0] + separator + key + '=' + value; 266 | if (typeof hash[1] !== 'undefined' && hash[1] !== null) 267 | url += '#' + hash[1]; 268 | return url; 269 | } else 270 | return url; 271 | } 272 | } 273 | window.addEventListener('click', function(e) { 274 | if (e.target.tagName === 'A' && e.target.getAttribute('data-need-reload')) { 275 | setTimeout(function() { 276 | location.reload(); 277 | }, 100); 278 | } 279 | }, true); 280 | }); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2019 Tao He 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /assets/gitbook/gitbook-plugin-search-pro/jquery.mark.min.js: -------------------------------------------------------------------------------- 1 | /*!*************************************************** 2 | * mark.js v8.8.0 3 | * https://github.com/julmot/mark.js 4 | * Copyright (c) 2014–2017, Julian Motz 5 | * Released under the MIT license https://git.io/vwTVl 6 | *****************************************************/ 7 | "use strict";function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}var _extends=Object.assign||function(a){for(var b=1;b-1||d.indexOf("Trident")>-1)&&(this.ie=!0)}return _createClass(c,[{key:"log",value:function a(b){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",a=this.opt.log;this.opt.debug&&"object"===("undefined"==typeof a?"undefined":_typeof(a))&&"function"==typeof a[c]&&a[c]("mark.js: "+b)}},{key:"escapeStr",value:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(a){return a=this.escapeStr(a),Object.keys(this.opt.synonyms).length&&(a=this.createSynonymsRegExp(a)),this.opt.ignoreJoiners&&(a=this.setupIgnoreJoinersRegExp(a)),this.opt.diacritics&&(a=this.createDiacriticsRegExp(a)),a=this.createMergedBlanksRegExp(a),this.opt.ignoreJoiners&&(a=this.createIgnoreJoinersRegExp(a)),a=this.createAccuracyRegExp(a)}},{key:"createSynonymsRegExp",value:function(a){var b=this.opt.synonyms,c=this.opt.caseSensitive?"":"i";for(var d in b)if(b.hasOwnProperty(d)){var e=b[d],f=this.escapeStr(d),g=this.escapeStr(e);a=a.replace(new RegExp("("+f+"|"+g+")","gm"+c),"("+f+"|"+g+")")}return a}},{key:"setupIgnoreJoinersRegExp",value:function(a){return a.replace(/[^(|)\\]/g,function(a,b,c){var d=c.charAt(b+1);return/[(|)\\]/.test(d)||""===d?a:a+"\0"})}},{key:"createIgnoreJoinersRegExp",value:function(a){return a.split("\0").join("[\\u00ad|\\u200b|\\u200c|\\u200d]?")}},{key:"createDiacriticsRegExp",value:function(a){var b=this.opt.caseSensitive?"":"i",c=this.opt.caseSensitive?["aàáâãäåāąă","AÀÁÂÃÄÅĀĄĂ","cçćč","CÇĆČ","dđď","DĐĎ","eèéêëěēę","EÈÉÊËĚĒĘ","iìíîïī","IÌÍÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóôõöøō","OÒÓÔÕÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúûüůū","UÙÚÛÜŮŪ","yÿý","YŸÝ","zžżź","ZŽŻŹ"]:["aÀÁÂÃÄÅàáâãäåĀāąĄăĂ","cÇçćĆčČ","dđĐďĎ","eÈÉÊËèéêëěĚĒēęĘ","iÌÍÎÏìíîïĪī","lłŁ","nÑñňŇńŃ","oÒÓÔÕÖØòóôõöøŌō","rřŘ","sŠšśŚșȘşŞ","tťŤțȚţŢ","uÙÚÛÜùúûüůŮŪū","yŸÿýÝ","zŽžżŻźŹ"],d=[];return a.split("").forEach(function(e){c.every(function(c){if(c.indexOf(e)!==-1){if(d.indexOf(c)>-1)return!1;a=a.replace(new RegExp("["+c+"]","gm"+b),"["+c+"]"),d.push(c)}return!0})}),a}},{key:"createMergedBlanksRegExp",value:function(a){return a.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(a){var b=this,c=this.opt.accuracy,d="string"==typeof c?c:c.value,e="string"==typeof c?[]:c.limiters,f="";switch(e.forEach(function(a){f+="|"+b.escapeStr(a)}),d){case"partially":default:return"()("+a+")";case"complementary":return"()([^\\s"+f+"]*"+a+"[^\\s"+f+"]*)";case"exactly":return"(^|\\s"+f+")("+a+")(?=$|\\s"+f+")"}}},{key:"getSeparatedKeywords",value:function(a){var b=this,c=[];return a.forEach(function(a){b.opt.separateWordSearch?a.split(" ").forEach(function(a){a.trim()&&c.indexOf(a)===-1&&c.push(a)}):a.trim()&&c.indexOf(a)===-1&&c.push(a)}),{keywords:c.sort(function(a,b){return b.length-a.length}),length:c.length}}},{key:"getTextNodes",value:function(a){var b=this,c="",d=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(a){d.push({start:c.length,end:(c+=a.textContent).length,node:a})},function(a){return b.matchesExclude(a.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){a({value:c,nodes:d})})}},{key:"matchesExclude",value:function(a){return e.matches(a,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(a,c,d){var e=this.opt.element?this.opt.element:"mark",f=a.splitText(c),g=f.splitText(d-c),h=b.createElement(e);return h.setAttribute("data-markjs","true"),this.opt.className&&h.setAttribute("class",this.opt.className),h.textContent=f.textContent,f.parentNode.replaceChild(h,f),g}},{key:"wrapRangeInMappedTextNode",value:function(a,b,c,d,e){var f=this;a.nodes.every(function(g,h){var i=a.nodes[h+1];if("undefined"==typeof i||i.start>b){var j=function(){if(!d(g.node))return{v:!1};var i=b-g.start,j=(c>g.end?g.end:c)-g.start,k=a.value.substr(0,g.start),l=a.value.substr(j+g.start);return g.node=f.wrapRangeInTextNode(g.node,i,j),a.value=k+l,a.nodes.forEach(function(b,c){c>=h&&(a.nodes[c].start>0&&c!==h&&(a.nodes[c].start-=j),a.nodes[c].end-=j)}),c-=j,e(g.node.previousSibling,g.start),c>g.end?void(b=g.end):{v:!1}}();if("object"===("undefined"==typeof j?"undefined":_typeof(j)))return j.v}return!0})}},{key:"wrapMatches",value:function(a,b,c,d,e){var f=this,g=0===b?0:b+1;this.getTextNodes(function(b){b.nodes.forEach(function(b){b=b.node;for(var e=void 0;null!==(e=a.exec(b.textContent))&&""!==e[g];)if(c(e[g],b)){var h=e.index;if(0!==g)for(var i=1;i1&&void 0!==arguments[1])||arguments[1],d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;_classCallCheck(this,a),this.ctx=b,this.iframes=c,this.exclude=d,this.iframesTimeout=e}return _createClass(a,[{key:"getContexts",value:function(){var a=void 0,c=[];return a="undefined"!=typeof this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(b.querySelectorAll(this.ctx)):[this.ctx]:[],a.forEach(function(a){var b=c.filter(function(b){return b.contains(a)}).length>0;c.indexOf(a)!==-1||b||c.push(a)}),c}},{key:"getIframeContents",value:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},d=void 0;try{var e=a.contentWindow;if(d=e.document,!e||!d)throw new Error("iframe inaccessible")}catch(a){c()}d&&b(d)}},{key:"isIframeBlank",value:function(a){var b="about:blank",c=a.getAttribute("src").trim(),d=a.contentWindow.location.href;return d===b&&c!==b&&c}},{key:"observeIframeLoad",value:function(a,b,c){var d=this,e=!1,f=null,g=function g(){if(!e){e=!0,clearTimeout(f);try{d.isIframeBlank(a)||(a.removeEventListener("load",g),d.getIframeContents(a,b,c))}catch(a){c()}}};a.addEventListener("load",g),f=setTimeout(g,this.iframesTimeout)}},{key:"onIframeReady",value:function(a,b,c){try{"complete"===a.contentWindow.document.readyState?this.isIframeBlank(a)?this.observeIframeLoad(a,b,c):this.getIframeContents(a,b,c):this.observeIframeLoad(a,b,c)}catch(a){c()}}},{key:"waitForIframes",value:function(a,b){var c=this,d=0;this.forEachIframe(a,function(){return!0},function(a){d++,c.waitForIframes(a.querySelector("html"),function(){--d||b()})},function(a){a||b()})}},{key:"forEachIframe",value:function(b,c,d){var e=this,f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},g=b.querySelectorAll("iframe"),h=g.length,i=0;g=Array.prototype.slice.call(g);var j=function(){--h<=0&&f(i)};h||j(),g.forEach(function(b){a.matches(b,e.exclude)?j():e.onIframeReady(b,function(a){c(b)&&(i++,d(a)),j()},j)})}},{key:"createIterator",value:function(a,c,d){return b.createNodeIterator(a,c,d,!1)}},{key:"createInstanceOnIframe",value:function(b){return new a(b.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(a,b,c){var d=a.compareDocumentPosition(c),e=Node.DOCUMENT_POSITION_PRECEDING;if(d&e){if(null===b)return!0;var f=b.compareDocumentPosition(c),g=Node.DOCUMENT_POSITION_FOLLOWING;if(f&g)return!0}return!1}},{key:"getIteratorNode",value:function(a){var b=a.previousNode(),c=void 0;return c=null===b?a.nextNode():a.nextNode()&&a.nextNode(),{prevNode:b,node:c}}},{key:"checkIframeFilter",value:function(a,b,c,d){var e=!1,f=!1;return d.forEach(function(a,b){a.val===c&&(e=b,f=a.handled)}),this.compareNodeIframe(a,b,c)?(e!==!1||f?e===!1||f||(d[e].handled=!0):d.push({val:c,handled:!0}),!0):(e===!1&&d.push({val:c,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(a,b,c,d){var e=this;a.forEach(function(a){a.handled||e.getIframeContents(a.val,function(a){e.createInstanceOnIframe(a).forEachNode(b,c,d)})})}},{key:"iterateThroughNodes",value:function(a,b,c,d,e){for(var f=this,g=this.createIterator(b,a,d),h=[],i=[],j=void 0,k=void 0,l=function(){var a=f.getIteratorNode(g);return k=a.prevNode,j=a.node};l();)this.iframes&&this.forEachIframe(b,function(a){return f.checkIframeFilter(j,k,a,h)},function(b){f.createInstanceOnIframe(b).forEachNode(a,c,d)}),i.push(j);i.forEach(function(a){c(a)}),this.iframes&&this.handleOpenIframes(h,a,c,d),e()}},{key:"forEachNode",value:function(a,b,c){var d=this,e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},f=this.getContexts(),g=f.length;g||e(),f.forEach(function(f){var h=function(){d.iterateThroughNodes(a,f,b,c,function(){--g<=0&&e()})};d.iframes?d.waitForIframes(f,h):h()})}}],[{key:"matches",value:function(a,b){var c="string"==typeof b?[b]:b,d=a.matches||a.matchesSelector||a.msMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector;if(d){var e=!1;return c.every(function(b){return!d.call(a,b)||(e=!0,!1)}),e}return!1}}]),a}();return c.fn.mark=function(a,b){return new d(this.get()).mark(a,b),this},c.fn.markRegExp=function(a,b){return new d(this.get()).markRegExp(a,b),this},c.fn.unmark=function(a){return new d(this.get()).unmark(a),this},c},window,document); --------------------------------------------------------------------------------