├── .github └── workflows │ └── hexo.yml ├── .gitignore ├── .gitmodules ├── README.md ├── _config.yml ├── package-lock.json ├── package.json ├── scaffolds ├── draft.md ├── page.md └── post.md ├── source ├── _posts │ ├── 6824.md │ ├── 6s081.md │ ├── cs144.md │ ├── csapp.md │ ├── meet.md │ ├── officehour.md │ └── reading.md ├── home.md ├── images │ ├── csapp.png │ ├── header.png │ ├── logo.png │ └── responsive.png ├── js │ └── menu-demo.js ├── menu.md └── slides │ └── r0 │ ├── w13-bourbon.pdf │ ├── w13-bourbon.pptx │ ├── week10-2.pdf │ ├── week12-1.pdf │ ├── week13-1.pdf │ ├── week14.pdf │ ├── week2-2.pdf │ ├── week3-1.pdf │ ├── week3-2.pdf │ ├── week5-1.pdf │ ├── week5-2.pdf │ ├── week6-1.pdf │ ├── week7-1.pdf │ ├── week8-1.pdf │ ├── week8-2.pdf │ ├── week9-1.pdf │ └── week9-2.pdf ├── themes └── hexo-theme-book │ ├── LICENSE │ ├── README.md │ ├── _config.yml │ ├── layout │ ├── _components │ │ ├── brand.ejs │ │ ├── menu.ejs │ │ ├── post-meta.ejs │ │ ├── sidebar-toggle.ejs │ │ └── toc.ejs │ ├── _lib │ │ ├── comments.ejs │ │ ├── google-analytics.ejs │ │ └── zooming-image.ejs │ ├── _partials │ │ ├── head.ejs │ │ ├── navbar.ejs │ │ └── post-info.ejs │ ├── archive.ejs │ ├── categories.ejs │ ├── index.ejs │ ├── layout.ejs │ ├── page.ejs │ ├── post.ejs │ └── tags.ejs │ ├── scripts │ ├── merge-configs.js │ └── render.js │ └── source │ ├── css │ ├── _components │ │ ├── brand.scss │ │ ├── comments.scss │ │ ├── highlight │ │ │ ├── diff.scss │ │ │ ├── highlight.scss │ │ │ └── theme.scss │ │ ├── menu.scss │ │ ├── post-meta.scss │ │ ├── post.scss │ │ ├── sidebar-toggle.scss │ │ └── toc.scss │ ├── _partials │ │ ├── book-archive.scss │ │ ├── book-content.scss │ │ ├── book-navbar.scss │ │ └── book-sidebar.scss │ ├── _variables.scss │ └── book.scss │ ├── favicon.png │ └── js │ ├── book-menu.js │ ├── book-post.js │ ├── book-toc.js │ └── book.js └── yarn.lock /.github/workflows/hexo.yml: -------------------------------------------------------------------------------- 1 | name: Hexo 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Use Node.js ${{ matrix.node_version }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node_version: ${{ matrix.node_version }} 20 | - name: Configuration environment 21 | env: 22 | DEPLOY_KEY: ${{ secrets.HEXO_CI_PRIVATE }} 23 | run: | 24 | mkdir -p ~/.ssh/ 25 | echo "$DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa 26 | chmod 600 ~/.ssh/id_rsa 27 | ssh-keyscan github.com >> ~/.ssh/known_hosts 28 | git config --global user.name "github-actions[bot]" 29 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 30 | - name: Update themes 31 | run: | 32 | git submodule init 33 | git submodule update 34 | - name: Install dependencies 35 | run: | 36 | npm i -g hexo-cli 37 | npm i 38 | - name: Generate hexo 39 | run: | 40 | hexo generate 41 | - name: Deploy hexo 42 | if: ${{ github.event_name != 'pull_request' }} 43 | run: | 44 | hexo deploy 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | db.json 4 | *.log 5 | node_modules/ 6 | public/ 7 | .deploy*/ 8 | docs/ 9 | 10 | source/_data/book.yml -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/.gitmodules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # learn-sys 2 | A website providing info for self-learners who want to explore the world of operating systems. The website template is from https://github.com/kaiiiz/hexo-theme-book-demo. This repo is the Chinese version. 3 | 4 | ## how to deploy? 5 | ```bash 6 | npm install 7 | hexo g 8 | hexo d 9 | ``` 10 | You may use `hexo s` to open a local server for preview. 11 | 12 | If errors occur please try nodejs 12. 13 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | # Hexo Configuration 2 | ## Docs: https://hexo.io/docs/configuration.html 3 | ## Source: https://github.com/hexojs/hexo/ 4 | 5 | # Site 6 | title: LearnSys 7 | subtitle: 8 | description: 9 | keywords: 10 | author: admin 11 | language: 12 | timezone: 13 | 14 | # URL 15 | ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' 16 | url: https://learn-sys.github.io/cn 17 | root: /cn 18 | permalink: :title/ 19 | permalink_defaults: 20 | 21 | # Directory 22 | source_dir: source 23 | public_dir: docs 24 | tag_dir: tags 25 | archive_dir: archives 26 | category_dir: categories 27 | code_dir: downloads/code 28 | i18n_dir: :lang 29 | skip_render: 30 | 31 | # Writing 32 | new_post_name: :title.md # File name of new posts 33 | default_layout: post 34 | titlecase: false # Transform title into titlecase 35 | external_link: true # Open external links in new tab 36 | filename_case: 0 37 | render_drafts: false 38 | post_asset_folder: true 39 | relative_link: false 40 | future: true 41 | highlight: 42 | enable: true 43 | line_number: true 44 | auto_detect: false 45 | tab_replace: '' 46 | 47 | # Home page setting 48 | # path: Root path for your blogs index page. (default = '') 49 | # per_page: Posts displayed per page. (0 = disable pagination) 50 | # order_by: Posts order. (Order by date descending by default) 51 | index_generator: 52 | path: '' 53 | per_page: 10 54 | order_by: -date 55 | 56 | # Category & Tag 57 | default_category: uncategorized 58 | category_map: 59 | tag_map: 60 | 61 | # Date / Time format 62 | ## Hexo uses Moment.js to parse and display date 63 | ## You can customize the date format as defined in 64 | ## http://momentjs.com/docs/#/displaying/format/ 65 | date_format: YYYY-MM-DD 66 | time_format: HH:mm:ss 67 | 68 | # Pagination 69 | ## Set per_page to 0 to disable pagination 70 | per_page: 10 71 | pagination_dir: page 72 | 73 | # Extensions 74 | ## Plugins: https://hexo.io/plugins/ 75 | ## Themes: https://hexo.io/themes/ 76 | theme: hexo-theme-book 77 | 78 | # Deployment 79 | ## Docs: https://hexo.io/docs/deployment.html 80 | deploy: 81 | type: git 82 | repo: git@github.com:learn-sys/cn 83 | branch: gh-pages 84 | 85 | markdown: 86 | render: 87 | html: true # Doesn't escape HTML content so the tags will appear as html. 88 | xhtmlOut: false # Parser will not produce XHTML compliant code. 89 | breaks: true # Parser produces `
` tags every time there is a line break in the source document. 90 | linkify: true # Returns text links as text. 91 | typographer: true # Substitution of common typographical elements will take place. 92 | quotes: '“”‘’' # "double" will be turned into “single” 93 | # 'single' will be turned into ‘single’ 94 | plugins: 95 | - markdown-it-abbr 96 | - markdown-it-container 97 | - markdown-it-deflist 98 | - markdown-it-emoji 99 | - markdown-it-footnote 100 | - markdown-it-imsize 101 | - markdown-it-ins 102 | - markdown-it-mark 103 | - markdown-it-regexp 104 | - markdown-it-sub 105 | - markdown-it-sup 106 | - markdown-it-checkbox 107 | - '@iktakahiro/markdown-it-katex' 108 | - name: markdown-it-container 109 | options: note 110 | - name: markdown-it-container 111 | options: tip 112 | - name: markdown-it-container 113 | options: attention 114 | anchors: 115 | # Minimum level for ID creation. (Ex. h2 to h6) 116 | level: 1 117 | # A suffix that is prepended to the number given if the ID is repeated. 118 | collisionSuffix: 'v' 119 | # If `true`, creates an anchor tag with a permalink besides the heading. 120 | permalink: false 121 | # Class used for the permalink anchor tag. 122 | permalinkClass: header-anchor 123 | # The symbol used to make the permalink 124 | permalinkSymbol: '# ' 125 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hexo-site", 3 | "version": "0.0.0", 4 | "private": true, 5 | "hexo": { 6 | "version": "4.2.1" 7 | }, 8 | "dependencies": { 9 | "@iktakahiro/markdown-it-katex": "^3.1.0", 10 | "hexo": "^4.2.1", 11 | "hexo-deployer-git": "^1.0.0", 12 | "hexo-generator-archive": "^0.1.5", 13 | "hexo-generator-category": "^0.1.3", 14 | "hexo-generator-index": "^0.2.1", 15 | "hexo-generator-tag": "^0.2.0", 16 | "hexo-renderer-ejs": "^0.3.1", 17 | "hexo-renderer-markdown-it": "git+https://github.com/hexojs/hexo-renderer-markdown-it.git", 18 | "hexo-renderer-scss": "^1.0.0", 19 | "hexo-renderer-stylus": "^0.3.3", 20 | "hexo-server": "^0.3.3", 21 | "markdown-it-abbr": "^1.0.4", 22 | "markdown-it-checkbox": "^1.1.0", 23 | "markdown-it-container": "^2.0.0", 24 | "markdown-it-deflist": "^2.0.3", 25 | "markdown-it-emoji": "^1.4.0", 26 | "markdown-it-footnote": "^3.0.2", 27 | "markdown-it-imsize": "^2.0.1", 28 | "markdown-it-ins": "^2.0.0", 29 | "markdown-it-mark": "^2.0.0", 30 | "markdown-it-regexp": "^0.4.0", 31 | "markdown-it-sub": "^1.0.0", 32 | "markdown-it-sup": "^1.0.0", 33 | "node-sass": "^4.13.0" 34 | } 35 | } -------------------------------------------------------------------------------- /scaffolds/draft.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{ title }} 3 | tags: 4 | --- 5 | -------------------------------------------------------------------------------- /scaffolds/page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{ title }} 3 | date: {{ date }} 4 | --- 5 | -------------------------------------------------------------------------------- /scaffolds/post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{ title }} 3 | date: {{ date }} 4 | tags: 5 | --- 6 | -------------------------------------------------------------------------------- /source/_posts/6824.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: MIT 6.824 3 | post_meta: false 4 | --- 5 | 6 | # MIT 6.824 7 | **课程网站:** https://pdos.csail.mit.edu/6.824/schedule.html 8 | **QQ群号:** 1160513631 9 | **门槛:** 独立完成6.824的第一个lab,入群需要验证GitHub Repo。 10 | **工具:** 并行测试 https://gist.github.com/jonhoo/f686cacb4b9fe716d5aa -------------------------------------------------------------------------------- /source/_posts/6s081.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: MIT 6.S081/6.828 3 | post_meta: false 4 | --- 5 | 6 | # MIT 6.S081/6.828 7 | **课程网站:** https://pdos.csail.mit.edu/6.S081/2020/schedule.html 8 | **QQ群号:** 603579009 9 | **门槛:** 独立完成CSAPP所有Lab,或独立完成6.S081或等效课程(如交大软院的OS、清华u-core、UMich EECS482等手写操作系统的课程)的前两个Lab。入群需要验证GitHub Repo。 10 | **资料:** 11 | 12 | - xv6-book 2020中文翻译:https://github.com/pleasewhy/xv6-book-2020-Chinese 13 | 14 | - lecture的中文翻译: https://github.com/huihongxiao/MIT6.S081 -------------------------------------------------------------------------------- /source/_posts/cs144.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CS144 3 | post_meta: false 4 | --- 5 | 6 | # CS 144: Introduction to Computer Networking 7 | 8 | **课程网站:** https://cs144.github.io/ 9 | **QQ群号:** 485077457 10 | **门槛:** 管理员暂时没有要求门槛 11 | -------------------------------------------------------------------------------- /source/_posts/csapp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CSAPP 3 | post_meta: false 4 | --- 5 | 6 | # Computer Systems: A Programmer's Perspective 7 | 8 | **课程网站:** http://csapp.cs.cmu.edu/3e/students.html 9 | **QQ群号:** 请用QQ扫描下面的二维码 10 | **门槛:** 理论上没有门槛 11 | ![](/cn/images/csapp.png) -------------------------------------------------------------------------------- /source/_posts/meet.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 面基 3 | post_meta: false 4 | --- 5 | 6 | # 面基 7 | 8 | 暂无介绍,等待大佬补充 -------------------------------------------------------------------------------- /source/_posts/officehour.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Systems Office Hours 3 | post_meta: false 4 | --- 5 | 6 | # Systems Office Hours 7 | 8 | 大概可以搞一个用来解答csapp、6.s081和6.824之类的课上的问题的Office Hours。志愿者招募中。。。:fire: 9 | 10 | 目前除了这个网址啥都是待定。有想法的同学快来commit吧! -------------------------------------------------------------------------------- /source/_posts/reading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 论文阅读小组 3 | post_meta: false 4 | --- 5 | 6 | # 论文阅读小组 7 | 8 | 通关/正在通关6.828的小伙伴们,我们一起来读paper吧! 9 | 10 | 这是一个以教学为目的的论文阅读小组,在一些学校通常作为OS的后续课程(如Advanced OS)。在这个小组中,我们将了解一些关于操作系统的高级话题,并轮流present一些在计算机系统领域有重要影响力的论文。 11 | 12 | ## 游戏规则 13 | 14 | 活动将每周进行一次,每次两小时,每小时一组,每组两人。其中包括20分钟的paper presentation,20分钟的Q&A,以及20分钟的分组讨论(6人一组,presenter和主持人会随机乱逛)。在presentation之前,presenter需要准备以CC BY-NC-SA 4.0开源的slides,并提前上传到本页面,原则上不可以使用他人的slides,但允许使用发表在论文中、或由论文作者提供的图片、表格和代码;presentation的时间分配每人至少五分钟; presentation鼓励使用中文,但不强制。在Q&A环节,除提问者外,鼓励所有人提出问题或者评论,可以是针对论文的,也可以是针对presenter的slides的;若无人主动提问,主持人会钦定提问者。 15 | 16 | 在每周的活动前,所有组员应自学该周活动对应的参考资料。参考资料包括论文(至少要大概了解)和视频(约每周一小时)。目前,视频有来自清华大学的高级操作系统([课程主页](http://os.cs.tsinghua.edu.cn/oscourse/AOS2020)/[B站](https://www.bilibili.com/video/BV1pC4y1x7iw?p=1)),感谢陈渝老师提供这些视频;上海交通大学的操作系统课程([课程主页](https://ipads.se.sjtu.edu.cn/courses/os)/[B站 MOOC版](https://www.bilibili.com/video/BV18y4y1i73U?p=1)),感谢IPADS实验室的老师们提供这些视频。 17 | 18 | 长期不来的同学将被移出小组。 19 | 20 | ## 准入门槛 21 | 22 | 为保证活动质量(显然,这玩意没什么scalability),论文阅读小组将只对以下三类同学开放: 23 | 24 | 1. 完成了MIT 6.S081或等效课程(如交大软院的OS、清华u-core、UMich EECS482等手写操作系统的课程)的超过60%的Lab的同学 25 | 2. 拿到了博士offer的同学以及一二年级博士生(高年级博士生欢迎作为主持人参加) 26 | 3. 曾在CCF C类以上系统会议上发表过论文的同学(作者顺序不限,发了A的就去做主持人吧) 27 | 28 | 每一轮原则上32人,若人数超标,将照顾第一类同学。 29 | 30 | 对于没有时间或不满足门槛、但对内容感兴趣的同学,我们也会在[b站上进行直播](http://live.bilibili.com/21829117),时间为北京时间每周六上午9点到10点半。录播暂定放在[这里](https://space.bilibili.com/6441785)。但是观看直播和录播的同学就没法参与讨论了。 31 | 32 | 也欢迎访问另一个没有门槛的、以科研为目的的、交流近期paper的讨论小组:https://aegis-readers.github.io/About/ 33 | 34 | ## 报名 35 | 36 | 报名已结束。请想给lecture、talk、office hour的老师和同学提交 [Pull Requests](https://github.com/learn-os-cn/learn-os-cn.github.io/pulls)。 37 | 38 | ## 召唤志愿者/Lecturer 39 | 40 | 我们热烈欢迎志愿者来做lecture,不限主题、领域、方式、时长、语言。请通过 [GitHub Issues](https://github.com/learn-os-cn/learn-os-cn.github.io/issues) 联系我们,我们会把您的lecture加入下面的时间表。Lecturer可自行选择是否公开视频、slides和文档,以及以哪种协议、在哪个平台公开。 41 | 42 | 我们也欢迎志愿者对下面的列表进行补充,请通过 [Pull Requests](https://github.com/learn-os-cn/learn-os-cn.github.io/pulls) 提交修改。 43 | 44 | 我们也欢迎志愿做主持人的老师和同学,请通过 [GitHub Issues](https://github.com/learn-os-cn/learn-os-cn.github.io/issues) 联系我们。 45 | 46 | ## 参考资料与时间表 47 | 48 | ### W0:破冰 49 | 50 | * 自我介绍、分组、游戏规则 51 | * 时间:北京时间2021年2月6日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1Ty4y1Y7gB/)。 52 | 53 | ### W1:操作系统 54 | 55 | * Video: [THU AOS P7 - P11](https://www.bilibili.com/video/BV1pC4y1x7iw?p=7);[论文作者在SOSP2009上的talk](https://www.youtube.com/watch?v=fZt1LILFyXY) 56 | * [The Multikernel: A new OS architecture for scalable multicore systems](https://people.inf.ethz.ch/troscoe/pubs/sosp09-barrelfish.pdf) 57 | * Presenter: [Zhi Guo](https://github.com/iaGuoZhi) 58 | * Presenter: [Mingyan Wang](http://mywong.cn) 59 | * [Slide](https://github.com/iaGuoZhi/PRESENTATION/blob/master/week1-multikernel.pptx) 60 | * 时间:北京时间2021年2月21日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1PU4y1s741/)。 61 | 62 | ### W2:虚拟化 63 | 64 | * Video: [THU AOS P12 - P21](https://www.bilibili.com/video/BV1pC4y1x7iw?p=12);[IPADS MOS P70 - P87](https://www.bilibili.com/video/BV18y4y1i73U?p=70) 65 | * Paper List - Presenter: ZeJiong Dong & Ruilin Wen 66 | * [Xen and the Art of Virtualization](https://www.cs.yale.edu/homes/yu-minlan/teach/csci599-fall12/papers/xen.pdf) 67 | * [My VM is Lighter (and Safer) than your Container](https://dl.acm.org/doi/10.1145/3132747.3132763) (Xen架构的改进,在[THU AOS P12 - P21](https://www.bilibili.com/video/BV1pC4y1x7iw?p=12)课程中已经有讲述) 68 | * [kvm: the Linux Virtual Machine Monitor](https://www.kernel.org/doc/ols/2007/ols2007v1-pages-225-230.pdf), [KVM/ARM: The Design and Implementation of the Linux ARM Hypervisor](https://www.cs.columbia.edu/~nieh/pubs/asplos2014_kvmarm.pdf) (KVM的概述和在ARM下的实现) 69 | * [Dune: Safe User-level Access to Privileged CPU Features](https://www.usenix.org/system/files/conference/osdi12/osdi12-final-117.pdf) (利用Intel VT-x虚拟化技术提供进程的抽象,在[THU AOS P12 - P21](https://www.bilibili.com/video/BV1pC4y1x7iw?p=12)课程中已经有讲述) 70 | * [Arrakis: The Operating System is the Control Plane](https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-peter_simon.pdf) (在硬件提供完善的虚拟化支持下的OS设计) 71 | * [W2 Slide Part1](https://github.com/ZENOTME/PRESENTATION/blob/master/week2-part1.pdf) 72 | * [W2 Slide Part2](https://github.com/ZENOTME/PRESENTATION/blob/master/week2-part2.pdf) 73 | * [Memory Resource Management in VMware ESX Server](https://www.usenix.org/legacy/event/osdi02/tech/full_papers/waldspurger/waldspurger.pdf) 74 | * [Live Migration of Virtual Machines](https://www.usenix.org/legacy/event/nsdi05/tech/full_papers/clark/clark.pdf) 75 | * Presenter: Jin Zhang 76 | * [Slide](/cn/slides/r0/week2-2.pdf) 77 | * 时间:北京时间2021年2月27日上午9点到11点,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1eK4y1J7Ym/)。 78 | 79 | ### W3:FPGA上的系统支持、从0开始写系统全家桶 80 | 81 | * [Catapult](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/Catapult_ISCA_2014.pdf), [Enzian](http://enzian.systems/), [AmorphOS](https://www.usenix.org/system/files/osdi18-khawaja.pdf), [Optimus](https://dl.acm.org/doi/abs/10.1145/3373376.3378482), and [Coyote](https://www.usenix.org/system/files/osdi20-korolija.pdf) 82 | * Presenter: [Jiacheng Ma](https://jcma.me) 83 | * Papers are for reference only; you are not required to read them before the event. 84 | * [Slide](/cn/slides/r0/week3-1.pdf) 85 | * 在自己写的CPU上用自己写的编译器编译自己写的操作系统并在上面跑自己写的程序 86 | * Presenter: [Yaotian Feng](https://github.com/codetector1374) 87 | * [Slide](/cn/slides/r0/week3-2.pdf) 88 | * 时间:北京时间2021年3月6日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1WZ4y1P7Yr/) 89 | 90 | ### W4:网络、分布式系统(一) 91 | * [Learning in situ: a randomized experiment in video streaming](https://www.usenix.org/conference/nsdi20/presentation/yan) 92 | * Presenter: Yuanli Wang @pentium3 93 | * [Slide](https://github.com/pentium3/mlsys_reading/files/5296409/situ.pptx) 94 | * [The Google File System](https://static.googleusercontent.com/media/research.google.com/en//archive/gfs-sosp2003.pdf) 95 | * Presenter: Xiangyun Ding, Jing Li 96 | * slide 97 | * 时间:北京时间2021年3月13日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1DN411Q7cJ/) 98 | 99 | ### W5:分布式系统(二) 100 | * [MapReduce: Simplified Data Processing on Large Clusters](https://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf) 101 | * Presenter: Wenyan Li 102 | * Presenter: Hao Feng 103 | * [Slide](/cn/slides/r0/week5-1.pdf) 104 | * [Time, Clocks, and the Ordering of Events in a Distributed System](https://lamport.azurewebsites.net/pubs/time-clocks.pdf) 105 | * Presenter: [Junchen Li](https://github.com/lijunchen) 106 | * Presenter: Yi Zhang 107 | * [Lamport's comment on this paper](https://lamport.azurewebsites.net/pubs/pubs.html#time-clocks) 108 | * [Slide](/cn/slides/r0/week5-2.pdf) 109 | * 时间:北京时间2021年3月20日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1y54y187Tn/) 110 | 111 | ### W6:程序分析、Debugging 112 | 113 | * [KLEE: Unassisted and Automatic Generation of High-Coverage Tests for Complex Systems Programs](http://www.doc.ic.ac.uk/~cristic/papers/klee-osdi-08.pdf) (Is this the best paper of symbolic execution?) 114 | * Presenter: Yongkang Meng 115 | * 时间:北京时间2021年3月27日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1Ty4y1b7iq/) 116 | * [Slide](/cn/slides/r0/week6-1.pdf) 117 | 118 | ### W7:安全和隐私 119 | * Host: Yu Liu 120 | * [Meltdown](https://meltdownattack.com/meltdown.pdf) 121 | * [Spectre](https://spectreattack.com/spectre.pdf) (TBD) 122 | * Presenter: MonKey Lee, Ruilin Wen 123 | * 时间:北京时间2021年4月10日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1nb4y1D7ii/) 124 | * [Slide](/cn/slides/r0/week7-1.pdf) 125 | 126 | ### W8:GPU & PIM(Processing in memory) 127 | * Introduction to GPU and GPU programming 128 | * Presenters: Ping Chen 129 | * [Slide](/cn/slides/r0/week8-1.pdf) 130 | * [ISAAC: a convolutional neural network accelerator with in-situ analog arithmetic in crossbars](https://dl.acm.org/doi/abs/10.1145/3007787.3001139) 131 | * Presenters: Siling Yang 132 | * [Slide](/cn/slides/r0/week8-2.pdf) 133 | * 时间:北京时间2021年4月17日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV18V411J7uT/) 134 | 135 | ### W9:机器学习系统(一) 136 | * Host: Zhiqiang 137 | * TensorFlow: Large-Scale Machine Learning on Heterogeneous Distributed Systems: [white paper](http://download.tensorflow.org/paper/whitepaper2015.pdf), [OSDI paper](https://www.usenix.org/system/files/conference/osdi16/osdi16-abadi.pdf) 138 | * Presenter: [Jinming Hu](https://conanhujinming.github.io/) 139 | * Presenter: Simei He 140 | * If you know nothing about AI&ML, [this video by Jeff Dean](https://www.youtube.com/watch?v=vzoe2G5g-w4) may be useful 141 | * This [official architecture overview](https://github.com/tensorflow/docs/blob/master/site/en/r1/guide/extend/architecture.md) is also helpful. 142 | * [Slide](/cn/slides/r0/week9-1.pdf) 143 | * [TVM: An Automated End-to-End Optimizing Compiler for Deep Learning](https://arxiv.org/pdf/1802.04799.pdf) 144 | * Presenter: [Cong Ding](https://tson1111.github.io/), rainie 145 | * [Slides](/cn/slides/r0/week9-2.pdf) 146 | * 时间:北京时间2021年4月24日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1GA41157mJ/) 147 | 148 | ### W10:机器学习系统(二) 149 | * [Retiarii: A Deep Learning Exploratory-Training Framework](https://www.usenix.org/system/files/osdi20-zhang_quanlu.pdf) 150 | * Presenter: [Xiaohu Tang](https://github.com/tigert1998) 151 | * [Slides](https://www.usenix.org/system/files/osdi20-zhang_quanlu.pdf) 152 | * GPU memory optimization during DNN training. 153 | * Presenter: Ping Chen 154 | * [Slides](/cn/slides/r0/week10-2.pdf) 155 | * 时间:北京时间2021年5月9日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1VV411E7Gb/) 156 | 157 | ### W11:新内存 158 | * Host: Ping Chen 159 | * transactional memory 160 | * [FPTree: A Hybrid SCM-DRAM Persistent and Concurrency B-Tree for Storage Class Memory](https://wwwdb.inf.tu-dresden.de/misc/papers/2016/Oukid_FPTree.pdf) 161 | * Presentor : [Chi Zhang](https://github.com/skyzh), [Siyu Liu](https://github.com/liusy58) 162 | * [Slides1](https://docs.google.com/presentation/d/1RHVP81jJHqHhzHACu98RZMNXxRMsa1pPllqjVkfIM7g/edit?usp=sharing) 163 | * [Spitfire: A Three-Tier Buffer Manager for Volatile and Non-Volatile Memory](https://zxjcarrot.github.io/publication/spitfire/spitfire.pdf) 164 | * Presentor : [Xinjing Zhou](https://zxjcarrot.github.io/) 165 | * [Slides](https://1drv.ms/p/s!ArFg8WfWy6iTwkYN5BMX7D5SPt4F) 166 | * 时间:北京时间2021年5月15日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1wf4y1Y7eZ/) 167 | 168 | ### W12:计算机网络 169 | * [BBR Congestion-Based Congestion Control](https://dl.acm.org/doi/pdf/10.1145/3012426.3022184) 170 | * Presentor : Yonghui Zhang 171 | * [Slides](/cn/slides/r0/week12-1.pdf) 172 | * [Data Center TCP (DCTCP)](https://pages.cs.wisc.edu/~remzi/Classes/739/Fall2015/Papers/dctcp-10.pdf) 173 | * Presentor : Baochen Qiao 174 | * 时间:北京时间2021年5月22日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1ry4y1g7AT/) 175 | 176 | ### W13:Log-Structured Merge Trees 177 | * [From WiscKey to Bourbon: A Learned Index for Log-Structured Merge Trees](https://www.usenix.org/system/files/osdi20-dai_0.pdf) 178 | * Presentor : [lambda](https://github.com/lambda7xx/), [Nope](https://zjs1224522500.github.io/) 179 | * [Slides - lsmt](/cn/slides/r0/week13-1.pdf) 180 | * [Slides - Bourbon](https://github.com/learn-sys/cn/blob/master/source/slides/r0/w13-bourbon.pdf) 181 | * 时间:北京时间2021年5月29日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1Zh411Y71H/) 182 | 183 | ### W14: Learned Index 184 | * Host: Zhiqiang Xie 185 | * [The Case for Learned Index Structures](https://arxiv.org/abs/1712.01208), [this video](https://www.youtube.com/watch?v=MM33CvATm_M) might be helpful 186 | * Presentor: Jinming Hu 187 | * [Slides](/cn/slides/r0/week14.pdf) 188 | * 时间:北京时间2021年6月5日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1V54y157oZ/) 189 | 190 | ### W15: Serverless (?) 191 | * [SAND: Towards High-Performance Serverless Computing](https://www.usenix.org/system/files/conference/atc18/atc18-akkus.pdf) 192 | * Presentor: Haoqi Zhuang, Weiqi Feng 193 | * 时间:北京时间2021年6月19日上午9点到10点半,[直播地址](http://live.bilibili.com/21829117),[录播地址](https://www.bilibili.com/video/BV1Hy4y1g7DQ/) 194 | -------------------------------------------------------------------------------- /source/home.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Home' 3 | comments: false 4 | post_meta: false 5 | --- 6 | 7 | # 计算机系统学习小组 8 | 9 | 这是一个由志愿者驱动的、旨在为自学若干门系统方向的公开课的小伙伴提供**抱团取暖**平台的、不负责任的网站 :) 10 | 11 | ## 课程与活动 12 | 13 | * CMU CSAPP: 计算机系统基础 :fire: 14 | * Stanford CS144:计算机网络 15 | * MIT 6.S081/6.828: 徒手造操作系统 16 | * MIT 6.824:分布式系统 17 | * 论文阅读小组:高级操作系统/计算机系统经典论文的阅读 18 | * 线上面基:全球最?的??交友网站? 19 | 20 | ## 召唤小伙伴 21 | 22 | 欢迎大家加群交流。不同的群有不同的准入门槛(主要是要求独立完成课程的若干个Lab证明你没在摸鱼:fish:)。希望大家在加群前至少先自学一部分公开课,加群后积极讨论。 23 | 24 | 这是一个由志愿者驱动的自学社区,没有人有回答问题的义务;但是,如果你觉得别人的回答有用,请在下次积极参与回答。 25 | 26 | CS公开课学习群:643874182,欢迎找不到组织的同学来这里一起建立新的组织。 27 | 28 | ## 召唤志愿者 29 | 30 | **欢迎大家帮助完善这个网站,请使用 [Pull Requests](https://github.com/learn-os-cn/learn-os-cn.github.io/pulls) 或在 [GitHub Issues](https://github.com/learn-os-cn/learn-os-cn.github.io/issues) 中让我们把你加入organization。** 31 | 32 | 欢迎大家挖新的坑。 33 | 34 | 欢迎抱团群的群主们通过 [Pull Requests](https://github.com/learn-os-cn/learn-os-cn.github.io/pulls) 或 [GitHub Issues](https://github.com/learn-os-cn/learn-os-cn.github.io/issues) 加入新的课程交流群。 35 | 36 | 欢迎大家来 present 你自己的、你老板的、你基友的、以及和你没什么关系的文章。 37 | 38 | 欢迎业界和学术界的大佬带大家起飞。 39 | 40 | 欢迎科研狗来打广告招人。 41 | 42 | ## 日历 43 | 44 | -------------------------------------------------------------------------------- /source/images/csapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/images/csapp.png -------------------------------------------------------------------------------- /source/images/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/images/header.png -------------------------------------------------------------------------------- /source/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/images/logo.png -------------------------------------------------------------------------------- /source/images/responsive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/images/responsive.png -------------------------------------------------------------------------------- /source/js/menu-demo.js: -------------------------------------------------------------------------------- 1 | var md_it = window.markdownit(); 2 | 3 | function init() { 4 | var menu = document.querySelector('.book-menu') 5 | menu.innerHTML = "" 6 | } 7 | 8 | function render_demo() { 9 | var text_area = document.querySelector('#demo_textarea') 10 | var text = text_area.value 11 | var render_text = md_it.render(text); 12 | var result_div = document.querySelector('.book-menu') 13 | result_div.innerHTML = render_text 14 | clear_invalid_syntax() 15 | pack_menu_accordion() 16 | } 17 | 18 | // UNIT 19 | function unit_header() { 20 | var text_area = document.querySelector('#demo_textarea') 21 | text_area.value = 22 | `\ 23 | \# H1 24 | \#\# H2 25 | \#\#\# H3 26 | \#\#\#\# H4 27 | \#\#\#\#\# H5 28 | \#\#\#\#\#\# H6 29 | ` 30 | render_demo() 31 | } 32 | function unit_list() { 33 | var text_area = document.querySelector('#demo_textarea') 34 | text_area.value = 35 | `\ 36 | * list 37 | * sub-list 38 | * sub-sub-list 39 | * sub-list 40 | * list 41 | ` 42 | render_demo() 43 | } 44 | function unit_invalid() { 45 | var text_area = document.querySelector('#demo_textarea') 46 | text_area.value = 47 | `\ 48 | 1. Ordered List 49 | 2. Ordered List 50 | 51 | Paragraph 52 | 53 | ![image](/hexo-theme-book-demo/favicon.ico) 54 | 55 | \`\`\` 56 | code 57 | \`\`\` 58 | 59 | | Tables | | | 60 | | ------ | ---- | ---- | 61 | | col1 | col2 | col3 | 62 | 63 | > Blockquote 64 | 65 | --- 66 | ` 67 | render_demo() 68 | } 69 | 70 | // Basic 71 | function basic_collapsed() { 72 | var text_area = document.querySelector('#demo_textarea') 73 | text_area.value = 74 | `\ 75 | \# H1 is separator 76 | 77 | \#\# H2 78 | 79 | - find nearest header 80 | - this unordered list will find H2 81 | 82 | \#\#\# H3 83 | 84 | - find nearest header 85 | - this unordered list will find H3 86 | 87 | \# H1 is separator 88 | 89 | \#\#\#\# H4 90 | 91 | - find nearest header 92 | - this unordered list will find H4 93 | 94 | \#\#\#\#\# H5 95 | 96 | - find nearest header 97 | - this unordered list will find H5 98 | 99 | \#\#\#\#\#\# H6 100 | 101 | - find nearest header 102 | - this unordered list will find H6 103 | ` 104 | render_demo() 105 | } 106 | 107 | function basic_uncollapsed() { 108 | var text_area = document.querySelector('#demo_textarea') 109 | text_area.value = 110 | `\ 111 | - this unordered list will find nothing 112 | - so it becomes an uncollapsed menu 113 | 114 | \# H1 is separator 115 | 116 | - this unordered list will find H1 117 | - so it becomes an uncollapsed menu 118 | 119 | \#\# H2 120 | 121 | - this unordered list will find H2 122 | - so it becomes a collapsed menu 123 | ` 124 | render_demo() 125 | } 126 | 127 | // Tricky 128 | function tricky_back_top() { 129 | var text_area = document.querySelector('#demo_textarea') 130 | text_area.value = 131 | `\ 132 | - this unordered list will find nothing 133 | - so it becomes an uncollapsed menu 134 | 135 | \# H1 is separator 136 | 137 | - this unordered list will find H1 138 | - so it becomes an uncollapsed menu 139 | 140 | \#\# H2 141 | 142 | - this unordered list will find H2 143 | - so it becomes a collapsed menu 144 | 145 | > in order to separates two lists, just insert an invalid syntax 146 | 147 | - this unordered list will skip H2 and find H1 148 | - so it becomes an uncollapsed menu 149 | ` 150 | render_demo() 151 | } -------------------------------------------------------------------------------- /source/menu.md: -------------------------------------------------------------------------------- 1 | * [**主页**](/) 2 | 3 | # **课程与活动** 4 | 5 | * [CSAPP](/cn/csapp) 6 | * [6.824](/cn/6824) 7 | * [6.S081/6.828](/cn/6s081) 8 | * [CS144](/cn/cs144) 9 | * [Office Hours](/cn/officehour) 10 | * [论文阅读小组](/cn/reading) 11 | * [面基](/cn/meet) 12 | 13 | # **Archives** 14 | 15 | # **Referrals** 16 | 17 | * [AEGIS Webinar](https://aegis-readers.github.io/About/) 18 | * [Awesome CS Courses](https://github.com/prakhar1989/awesome-courses) 19 | * [OSSU](https://github.com/ossu/computer-science) 20 | -------------------------------------------------------------------------------- /source/slides/r0/w13-bourbon.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/w13-bourbon.pdf -------------------------------------------------------------------------------- /source/slides/r0/w13-bourbon.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/w13-bourbon.pptx -------------------------------------------------------------------------------- /source/slides/r0/week10-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week10-2.pdf -------------------------------------------------------------------------------- /source/slides/r0/week12-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week12-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week13-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week13-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week14.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week14.pdf -------------------------------------------------------------------------------- /source/slides/r0/week2-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week2-2.pdf -------------------------------------------------------------------------------- /source/slides/r0/week3-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week3-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week3-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week3-2.pdf -------------------------------------------------------------------------------- /source/slides/r0/week5-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week5-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week5-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week5-2.pdf -------------------------------------------------------------------------------- /source/slides/r0/week6-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week6-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week7-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week7-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week8-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week8-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week8-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week8-2.pdf -------------------------------------------------------------------------------- /source/slides/r0/week9-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week9-1.pdf -------------------------------------------------------------------------------- /source/slides/r0/week9-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/source/slides/r0/week9-2.pdf -------------------------------------------------------------------------------- /themes/hexo-theme-book/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 kaiiiz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /themes/hexo-theme-book/README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |
A simple, elegant, book-like hexo theme with some useful features. 4 |
5 |

6 | 7 | ![book-preview](https://kaiiiz.github.io/hexo-theme-book-demo/images/header.png) 8 | 9 | ## ⚠ Notice 10 | 11 | Since I have already migrated my note from hexo to [hugo](https://gohugo.io/), the development progress may be slow down in the future. If you want to add more features to this theme, fill free to fork and modify it by yourself. Though I will not put a lot efforts in this project, any suggestions are still welcome. 12 | 13 | However, I suggest that you should try hugo first before using hexo (if you never used both). Hugo is writen by go-lang, and it is faster, powerful and lighter than hexo in my opinion. After doing some research, I realized that hugo can meet all of my requirements and also provide a more logical way to customize a theme at the same time which is amazing, you guys should give it a try! 14 | 15 | ## 💿 Installation 16 | 17 | ``` 18 | git clone https://github.com/kaiiiz/hexo-theme-book.git themes/book 19 | ``` 20 | 21 | If you don't have scss renderer, follow this: 22 | 23 | ``` 24 | npm install hexo-renderer-scss --save 25 | ``` 26 | 27 | Modify `theme` entry in `_config.yml` 28 | 29 | ``` 30 | theme: book 31 | ``` 32 | 33 | ### Change markdown renderer 34 | 35 | For better render quality, I suggest that you should change the default renderer. 36 | 37 | The detail, see [change markdown renderer](https://github.com/kaiiiz/hexo-theme-book/wiki/Change-markdown-renderer) 38 | 39 | ## 🎈 Update 40 | 41 | Jump into the theme folder, run `git pull`. If you use `/source/_data/book.yml`, please note the diffrence of updated `_config.yml`. 42 | 43 | ### Smooth Update 44 | 45 | For smoothly updating, I recommand to create a config file named `book.yml` in `/source/_data` folder (If it doesn't exist, create one) 46 | 47 | > **Notice: source folder is under your hexo working directory, not the theme one!** 48 | 49 | Copy the contents of `/themes/book/_config.yml` to `/source/_data/book.yml`, it will replace the contents of config in `/themes/book/_config.yml`. Now you can configure it independently and also, you can update theme more smoothly. 50 | 51 | ## ⚒ Configurations 52 | 53 | The detail of config, see [Configurations](https://github.com/kaiiiz/hexo-theme-book/wiki/Configuration) 54 | 55 | ## 🎁 Features 56 | 57 | **External Library Integration:** 58 | 59 | Comments system: 60 | 61 | * [utterances](https://github.com/utterance/utterances) 62 | * [disqus](https://disqus.com/) 63 | * [gitalk](https://github.com/gitalk/gitalk) 64 | 65 | Others: 66 | 67 | * [zooming](https://github.com/kingdido999/zooming) 68 | * [google analytics](https://analytics.google.com/) 69 | 70 | **Code Syntax Highlight:** 71 | 72 | Using the built-in systax highlight system ([highlight.js](https://highlightjs.org/)) supported from hexo itself, so no other configuration is needed. 73 | 74 | However, there are multiple themes integrated from [tomorrow-theme](https://github.com/chriskempson/tomorrow-theme). You can change the theme in `_config.yml`. 75 | 76 | | Normal | Night | Night Eighties | Night Blue | Night Bright 77 | | --- | --- | --- | --- | --- | 78 | | ![](https://github.com/ChrisKempson/Tomorrow-Theme/raw/master/Images/Tomorrow.png) | ![](https://github.com/ChrisKempson/Tomorrow-Theme/raw/master/Images/Tomorrow-Night.png) | ![](https://raw.githubusercontent.com/ChrisKempson/Tomorrow-Theme/master/Images/Tomorrow-Night-Eighties.png) | ![](https://raw.githubusercontent.com/ChrisKempson/Tomorrow-Theme/master/Images/Tomorrow-Night-Blue.png) | ![](https://raw.githubusercontent.com/ChrisKempson/Tomorrow-Theme/master/Images/Tomorrow-Night-Bright.png) 79 | 80 | **Powerful and Fully-Customized Sidebar Menu:** 81 | 82 | Checkout [Menu Realtime Demo](https://kaiiiz.github.io/hexo-theme-book-demo/demo/menu-realtime/) 83 | 84 | **Responsive Layout:** 85 | 86 | Book will adapt to different viewpoints in order to give you the best reading experience. 87 | 88 | ![](https://kaiiiz.github.io/hexo-theme-book-demo/images/responsive.png) 89 | 90 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/_config.yml: -------------------------------------------------------------------------------- 1 | home_page: home.md # filepath under /source/ 2 | menu_page: menu.md # filepath under /source/ 3 | author_img: # filepath of author image 4 | favicon_url: favicon.png # filepath of favicon 5 | 6 | zoom_image: false 7 | codeblock: 8 | # Code Highlight theme 9 | # Available values: normal | night | night eighties | night blue | night bright | solarized | solarized dark | galactic 10 | highlight_theme: normal 11 | 12 | comments: 13 | utterances: 14 | enable: false 15 | user: # your github user name 16 | repo: # your github repo name 17 | theme: github-light # github-light | github-dark | github-dark-orange | icy-dark | dark-blue | photon-dark 18 | disqus: 19 | enable: false 20 | shortname: # your disqus shortname 21 | gitalk: 22 | enable: false 23 | githubID: # your github id 24 | repo: # GitHub repository e.g. kaiiiz.github.io 25 | ClientID: # GitHub Application Client ID 26 | ClientSecret: # GitHub Application Client Secret 27 | adminUser: # GitHub repository owner and collaborators 28 | labels: 'gitalk' # GitHub issue labels 29 | distractionFreeMode: true 30 | 31 | google_analytics: 32 | 33 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_components/brand.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | <%= config.title.toUpperCase() %> 5 | 6 |
-------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_components/menu.ejs: -------------------------------------------------------------------------------- 1 | 4 | 5 | <%- js('js/book-menu') %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_components/post-meta.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 6 |
7 | <% if (page.author_img) { %> 8 |
9 | ... 10 |
11 | <% } else if (theme.author_img) { %> 12 |
13 | ... 14 |
15 | <% } else { %> 16 |
20 |
21 | <% } %> 22 |
23 | 24 | 25 |
26 |
<%= page.author ? page.author : config.author %>
27 |
<%= page.date ? page.date.format(config.date_format) : "" %>
28 |
29 |
30 | 31 | <% if ( (page.categories && page.categories.length) || (page.tags && page.tags.length) ) { %> 32 |
33 | 34 | 50 | 51 | <% } %> 52 | 53 |
54 |
-------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_components/sidebar-toggle.ejs: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_components/toc.ejs: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 全部展开 5 | 回到顶部 6 | 前往底部 7 |
8 | 9 | <%- js('js/book-toc') %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_lib/comments.ejs: -------------------------------------------------------------------------------- 1 | <% if(theme.comments.utterances.enable) { %> 2 | 9 | <% } %> 10 | 11 | <% if(theme.comments.disqus.enable) { %> 12 |
13 | 21 | 22 | <% } %> 23 | 24 | <% if(theme.comments.gitalk.enable) { %> 25 | 26 | 27 |
28 | 40 | <% } %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_lib/google-analytics.ejs: -------------------------------------------------------------------------------- 1 | <% if (theme.google_analytics){ %> 2 | 3 | 4 | 11 | 12 | <% } %> 13 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_lib/zooming-image.ejs: -------------------------------------------------------------------------------- 1 | <% if (theme.zoom_image && (page.zoom_image === undefined || page.zoom_image)){ %> 2 | 3 | 9 | <% } %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_partials/head.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <% if (theme.favicon_url) { %> 6 | 7 | <% } %> 8 | 9 | 10 | <% if (page.title) { %> 11 | <%= page.title + ' - ' + config.title %> 12 | <% } else{%> 13 | <%= config.title %> 14 | <% } %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | <%- css('css/book') %> 24 | <%- js('js/book') %> 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | <%- partial('_lib/google-analytics') %> 34 | <%- partial('_lib/zooming-image') %> 35 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_partials/navbar.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/_partials/post-info.ejs: -------------------------------------------------------------------------------- 1 |
2 | <% if (page.post_meta === undefined || page.post_meta) { %> 3 | <%- partial('_components/post-meta') %> 4 | <% } %> 5 | 6 | <%- partial('_components/toc') %> 7 |
-------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/archive.ejs: -------------------------------------------------------------------------------- 1 |
2 | 3 | <% if(is_archive()){ %> 4 |

Archives

5 | <% } else if(is_category()) { %> 6 |

Category - <%= page.category %>

7 | <% } else if(is_tag()) { %> 8 |

Tag - <%= page.tag %>

9 | <% } %> 10 | 11 | <% if(is_current('archives')) { %> 12 | 13 | <% 14 | var years = {}; 15 | site.posts.sort('date').reverse().forEach(function(post){ 16 | var year = post.date.year() 17 | if(years[year]===undefined){ 18 | years[year] = []; 19 | } 20 | years[year].push(post); 21 | }); 22 | %> 23 | <% } else { %> 24 | 25 | <% 26 | var years = {}; 27 | page.posts.sort('date').reverse().forEach(function(post){ 28 | var year = post.date.year() 29 | if(years[year]===undefined){ 30 | years[year] = []; 31 | } 32 | years[year].push(post); 33 | }); 34 | %> 35 | <% } %> 36 | 37 | <% Object.keys(years).reverse().forEach(function(year){ %> 38 |
39 |

<%= year %>

40 | 50 |
51 | <% }) %> 52 | 53 | <% if(!is_current('archives') && page.total > 1) {%> 54 | 57 | <% } %> 58 |
-------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/categories.ejs: -------------------------------------------------------------------------------- 1 | <% const categoriesList = list_categories({ show_count: false }); %> 2 |
3 |

Categories

4 | <% if (categoriesList !== "") { %> 5 | <%-categoriesList%> 6 | <% } else { %> 7 |

None.

8 | <% } %> 9 |
-------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/index.ejs: -------------------------------------------------------------------------------- 1 | <%- partial('post') %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/layout.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%- partial('_partials/head') %> 5 | 6 | 7 | 8 |
9 |
10 | <%- partial('_components/brand') %> 11 | <%- partial('_components/menu') %> 12 |
13 | 14 | <%- partial('_components/sidebar-toggle') %> 15 | 16 |
17 |
18 |
19 |
20 | <%- partial('_partials/navbar') %> 21 |
22 |
23 | <%- body %> 24 |
25 |
26 |
27 | <%- partial('_partials/post-info') %> 28 |
29 |
30 |
31 | 32 | 33 |
34 | 35 | 36 | 37 | 38 | <%- js('js/book') %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/page.ejs: -------------------------------------------------------------------------------- 1 | 2 |
3 |

<%=page.title%>

4 | <%-page.content%> 5 |
6 | 7 |
8 | <%-paginator()%> 9 |
10 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/post.ejs: -------------------------------------------------------------------------------- 1 |
2 | <%- page.content %> 3 |
4 | 5 | <% if(page.comments === undefined || page.comments) { %> 6 |
7 | <%- partial('_lib/comments') %> 8 |
9 | <% } %> 10 | 11 | <%- js('js/book-post') %> -------------------------------------------------------------------------------- /themes/hexo-theme-book/layout/tags.ejs: -------------------------------------------------------------------------------- 1 | <% const tagsList = list_tags({ show_count: false }); %> 2 |
3 |

Tags

4 | <% if (tagsList !== "") { %> 5 | <%-tagsList%> 6 | <% } else { %> 7 |

None.

8 | <% } %> 9 |
-------------------------------------------------------------------------------- /themes/hexo-theme-book/scripts/merge-configs.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | 3 | 'use strict'; 4 | 5 | hexo.on('generateBefore', function () { 6 | if (hexo.locals.get) { 7 | var data = hexo.locals.get('data') 8 | data && data.book && (hexo.theme.config = data.book) 9 | } 10 | }) -------------------------------------------------------------------------------- /themes/hexo-theme-book/scripts/render.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | 3 | 'use strict'; 4 | 5 | var ejs = require('ejs'); 6 | 7 | var menu_file, home_file; 8 | 9 | // before_post_render 10 | 11 | hexo.extend.filter.register('before_post_render', function (data) { 12 | // preprocess markdown file 13 | }) 14 | 15 | // after_post_render 16 | 17 | hexo.extend.filter.register('after_post_render', function (data) { 18 | // checkbox in list 19 | let checkbox_pattern = /
  • ([\s]*)| checked="true">| checked>)/g; 20 | let checkbox_replacement = "
  • $1 *:first-child { 7 | margin-top: 0 !important; 8 | } 9 | 10 | h1, 11 | h2, 12 | h3, 13 | h4, 14 | h5, 15 | h6 { 16 | font-weight: bold; 17 | margin-bottom: $line-margin; 18 | margin-top: $line-margin * 1.7; 19 | } 20 | 21 | h1, 22 | h2 { 23 | padding-bottom: 0.4rem; 24 | border-bottom: 1px solid $border-color 25 | } 26 | 27 | h1 { 28 | font-size: $font-size-largest; 29 | } 30 | 31 | h2 { 32 | font-size: $font-size-large; 33 | 34 | } 35 | 36 | h3 { 37 | font-size: $font-size-medium; 38 | } 39 | 40 | h4 { 41 | font-size: $font-size-small; 42 | } 43 | 44 | h5 { 45 | font-size: $font-size-smaller; 46 | } 47 | 48 | h6 { 49 | font-size: $font-size-smallest; 50 | color: grey; 51 | } 52 | 53 | p { 54 | margin-bottom: $line-margin; 55 | } 56 | 57 | hr { 58 | border: 1px solid $border-color; 59 | background-color: $border-color; 60 | margin: $line-margin 0; 61 | } 62 | 63 | .table-wrapper { 64 | max-width: 100%; 65 | margin: 1.25rem 0; 66 | overflow: auto; 67 | 68 | table { 69 | width: 100%; 70 | border-spacing: 0px; 71 | border-collapse: collapse; 72 | 73 | th, 74 | td { 75 | padding: 0.7rem; 76 | border: 1px solid $border-color; 77 | text-align: left; 78 | } 79 | } 80 | } 81 | 82 | ul, 83 | ol { 84 | list-style-position: outside; 85 | margin: 0 0 $line-margin 1.4rem; 86 | 87 | ol { 88 | margin-top: 0; 89 | margin-bottom: 0; 90 | } 91 | 92 | ul { 93 | margin-top: 0; 94 | margin-bottom: 0; 95 | } 96 | 97 | p { 98 | margin: 0; 99 | } 100 | } 101 | 102 | blockquote { 103 | margin: 1.125rem 0 1.125rem 0; 104 | padding: 0.2rem 1rem; 105 | 106 | p { 107 | margin-bottom: 0.5rem; 108 | } 109 | 110 | p:last-child { 111 | margin-bottom: 0; 112 | } 113 | 114 | ul:last-child { 115 | margin-bottom: 0; 116 | } 117 | 118 | &.right { 119 | border-left: none; 120 | border-right: .1rem solid #dadee4; 121 | } 122 | } 123 | 124 | @mixin md-container($border-color, $background-color) { 125 | margin: 1.125rem 1.125rem 1.125rem 0; 126 | padding: 0.2rem 1rem; 127 | background-color: $background-color; 128 | border-left: .1rem solid $border-color; 129 | 130 | p { 131 | margin-bottom: 0.5rem; 132 | } 133 | 134 | p:last-child { 135 | margin-bottom: 0; 136 | } 137 | 138 | ul:last-child { 139 | margin-bottom: 0; 140 | } 141 | } 142 | 143 | .note { 144 | @include md-container(#6ab0de, #e7f2fa) 145 | } 146 | 147 | .tip { 148 | @include md-container(#1abc9c, #dbfaf4) 149 | } 150 | 151 | .attention { 152 | @include md-container(#f0b37e, #ffedcc) 153 | } 154 | 155 | .video-container { 156 | position: relative; 157 | margin-bottom: 1.5rem; 158 | padding-bottom: 56.25%; 159 | height: 0; 160 | overflow: hidden; 161 | 162 | iframe { 163 | position: absolute; 164 | width: 100%; 165 | height: 100%; 166 | top: 0; 167 | left: 0; 168 | } 169 | } 170 | 171 | figcaption { 172 | text-align: center; 173 | font-size: $font-size-smaller; 174 | margin: 0.5rem 0; 175 | } 176 | 177 | img { 178 | display: block; 179 | margin-left: auto; 180 | margin-right: auto; 181 | } 182 | 183 | iframe { 184 | width: 100%; 185 | } 186 | 187 | .checkbox-item { 188 | list-style-type: none; 189 | 190 | input { 191 | margin-left: -1rem; 192 | margin-right: 0.4rem; 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_components/sidebar-toggle.scss: -------------------------------------------------------------------------------- 1 | .sidebar-toggle { 2 | position: fixed; 3 | bottom: 0.6rem; 4 | left: $sidebar-width + 0.7rem; 5 | transition: left 200ms; 6 | 7 | display: flex; 8 | justify-content: center; 9 | align-items: center; 10 | border: 1px solid #686868; 11 | border-radius: 50%; 12 | width: 9px; 13 | height: 9px; 14 | 15 | &.extend { 16 | left: 0.7rem; 17 | } 18 | 19 | @media all and (max-width: $pc-media) { 20 | display: none; 21 | } 22 | 23 | > .sidebar-toggle-inner { 24 | width: 4px; 25 | height: 4px; 26 | border-radius: 50%; 27 | background-color: #686868; 28 | display: none; 29 | 30 | &.show { 31 | display: block; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_components/toc.scss: -------------------------------------------------------------------------------- 1 | .book-tocbot { 2 | // max-height: onload initialized 3 | overflow: auto; 4 | position: relative; 5 | padding-right: 0.875rem; 6 | transition: max-height 0.15s ease-in-out; 7 | 8 | ul { 9 | list-style: none; 10 | position: inherit; 11 | overflow: hidden; 12 | 13 | li { 14 | margin-left: 0.25rem; 15 | } 16 | } 17 | 18 | .toc-link::before { 19 | background-color: white !important; 20 | } 21 | 22 | .is-active-link::before { 23 | background-color: $book-primary-color !important; 24 | } 25 | } 26 | 27 | .book-tocbot-menu { 28 | margin: 1rem 0.75rem; 29 | 30 | a { 31 | display: block; 32 | margin: 0.375rem 0; 33 | color: #999; 34 | cursor: pointer; 35 | } 36 | 37 | a:hover { 38 | color: gray; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_partials/book-archive.scss: -------------------------------------------------------------------------------- 1 | .book-archive { 2 | h1, 3 | h2 { 4 | margin: 0; 5 | } 6 | 7 | h1 { 8 | font-size: $font-size-max; 9 | font-weight: bold; 10 | padding-bottom: 0.5rem; 11 | margin-bottom: 1rem; 12 | } 13 | 14 | h2 { 15 | font-size: $font-size-medium; 16 | padding-bottom: 0.75rem; 17 | margin-bottom: 0.75rem; 18 | border-bottom: 1px solid $border-color; 19 | } 20 | 21 | .years { 22 | padding-bottom: 1.25rem; 23 | } 24 | 25 | .archive-list-item { 26 | list-style: none; 27 | margin: 0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_partials/book-content.scss: -------------------------------------------------------------------------------- 1 | .book-content { 2 | padding: 0 $post-horizontal-pd-lg; 3 | 4 | @media all and (max-width: $pc-media) { 5 | padding: 0 1.25rem; 6 | } 7 | 8 | @import "../_components/post"; 9 | @import "../_components/comments"; 10 | @import "../_components/highlight/highlight"; 11 | } 12 | 13 | .book-post-info { 14 | position: fixed; 15 | font-size: $font-size-smaller; 16 | 17 | @media all and (min-width: $pc-media) { 18 | max-width: $post-info-max-width-xl; 19 | } 20 | 21 | @media all and (min-width: $pad-media) and (max-width: $pcs-media) { 22 | max-width: $post-info-max-width-lg; 23 | } 24 | 25 | @import "../_components/post-meta"; 26 | @import "../_components/toc"; 27 | } 28 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_partials/book-navbar.scss: -------------------------------------------------------------------------------- 1 | .book-navbar { 2 | padding-top: 0; 3 | padding-right: $post-horizontal-pd-lg; 4 | padding-bottom: 1.5rem; 5 | padding-left: $post-horizontal-pd-lg; 6 | 7 | i { 8 | color: $book-primary-link-color; 9 | } 10 | 11 | @media all and (min-width: $pc-media) { 12 | display: none; 13 | } 14 | 15 | @media all and (max-width: $pcs-media) { 16 | display: block; 17 | } 18 | 19 | @media all and (max-width: $pc-media) { 20 | padding-right: $post-horizontal-pd-md; 21 | padding-left: $post-horizontal-pd-md; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_partials/book-sidebar.scss: -------------------------------------------------------------------------------- 1 | .book-sidebar { 2 | position: fixed; 3 | width: $sidebar-width; 4 | height: 100%; 5 | z-index: 500; 6 | 7 | background-color: #f7f8f9; 8 | transition: transform 0.2s; 9 | 10 | &.show { 11 | transform: translateX(0); 12 | } 13 | 14 | &.hide { 15 | transform: translateX(-100%); 16 | } 17 | 18 | @media all and (min-width: $pc-media) { 19 | transform: translateX(0); 20 | } 21 | 22 | @media all and (max-width: $pcs-media) { 23 | transform: translateX(-100%); 24 | } 25 | 26 | @import "../_components/brand"; 27 | @import "../_components/menu"; 28 | } 29 | 30 | @import "../_components/sidebar-toggle"; -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/_variables.scss: -------------------------------------------------------------------------------- 1 | $book-primary-color: #004ed0; 2 | $book-primary-link-color: rgb(47, 47, 47); 3 | $book-primary-link-hover-color: rgb(128, 128, 128); 4 | $book-link-color: #004ed0; 5 | $book-link-visited-color: #7170db; 6 | $book-link-hover-color: rgb(109, 109, 109); 7 | $border-color: #e7e7e7; 8 | 9 | // font size 10 | $font-size-base : 20px; 11 | $font-size-min : .5rem; 12 | $font-size-smallest : .6rem; 13 | $font-size-smaller : .7rem; 14 | $font-size-small : .8rem; 15 | $font-size-medium : 1rem; 16 | $font-size-large : 1.125rem; 17 | $font-size-larger : 1.2rem; 18 | $font-size-largest : 1.4rem; 19 | $font-size-max : 1.6rem; 20 | 21 | // medias 22 | $pc-media : 1280px; 23 | $pcs-media : 1279px; 24 | $pad-media : 960px; 25 | $pads-media : 959px; 26 | 27 | // code highlight 28 | $code-font-family : consolas, Menlo, monospace; 29 | $code-border-radius : 3px; 30 | $code-foreground : #555; 31 | $code-background : #eee; 32 | 33 | $content-font-family : sans-serif; 34 | 35 | // layout definition 36 | $content-padding-xl : 2.2rem; 37 | $content-padding-lg : 1.5rem; 38 | $content-padding-md : .75rem; 39 | 40 | $post-info-max-width-xl : 10rem; 41 | $post-info-max-width-lg : 8.5rem; 42 | 43 | $post-horizontal-pd-lg : 4rem; 44 | $post-horizontal-pd-md : 1.25rem; 45 | 46 | $sidebar-width : 12rem; 47 | $sidebar-starting-pd : 1.25rem; 48 | $sidebar-ending-pd : .6rem; 49 | $sidebar-brand-height : 2rem; 50 | $sidebar-brand-fsize : .8rem; 51 | $sidebar-menu-depth : .5rem; 52 | $sidebar-menu-spacing : .625rem; 53 | 54 | // post style 55 | $line-margin : 1rem; -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/css/book.scss: -------------------------------------------------------------------------------- 1 | @import "variables"; 2 | 3 | .book-container { 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | html { 9 | margin: 0; 10 | height: 100%; 11 | font-size: $font-size-base; 12 | } 13 | 14 | body { 15 | font-size: $font-size-small; 16 | } 17 | 18 | a { 19 | color: $book-link-color; 20 | } 21 | 22 | a:visited { 23 | color: $book-link-visited-color; 24 | } 25 | 26 | a:hover { 27 | color: $book-link-hover-color; 28 | text-decoration: none; 29 | } 30 | 31 | img { 32 | max-width: 100%; 33 | max-height: 100%; 34 | } 35 | 36 | .right { 37 | text-align: right; 38 | } 39 | 40 | .left { 41 | text-align: left; 42 | } 43 | 44 | .off-canvas-overlay { 45 | background: rgba(0, 0, 0, 0.2); 46 | position: fixed; 47 | display: none; 48 | top: 0; 49 | left: 0; 50 | width: 100%; 51 | height: 100%; 52 | z-index: 499; 53 | 54 | &.show { 55 | display: block; 56 | } 57 | 58 | @media all and (min-width: $pc-media) { 59 | display: none !important; 60 | } 61 | } 62 | 63 | .off-canvas-content { 64 | height: 100%; 65 | font-family: $content-font-family; 66 | transition: margin 200ms; 67 | 68 | @import "_partials/book-content"; 69 | 70 | &.extend { 71 | margin-left: 0; 72 | } 73 | 74 | @media all and (min-width: $pc-media) { 75 | margin-left: $sidebar-width; 76 | padding: $content-padding-xl $content-padding-xl; 77 | } 78 | 79 | @media all and (min-width: $pad-media) and (max-width: $pcs-media) { 80 | padding: $content-padding-xl $content-padding-lg; 81 | } 82 | 83 | @media all and (max-width: $pads-media) { 84 | padding: $content-padding-xl $content-padding-md; 85 | } 86 | } 87 | 88 | @import "_partials/book-navbar"; 89 | @import "_partials/book-sidebar"; 90 | @import "_partials/book-archive"; 91 | -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/learn-sys/cn/f6af2c338b873be2ee6a8be24cc8247e83f67f4e/themes/hexo-theme-book/source/favicon.png -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/js/book-menu.js: -------------------------------------------------------------------------------- 1 | function collapse(name, body, i) { 2 | if (name.classList.contains('accordion')) { 3 | var acco_body = name.querySelector('.accordion-body'); 4 | acco_body.appendChild(body); 5 | return name; 6 | } 7 | 8 | var accordion = document.createElement('div'); 9 | accordion.setAttribute("class", "accordion"); 10 | 11 | var acco_body = document.createElement('div'); 12 | acco_body.setAttribute("class", "accordion-body"); 13 | acco_body.appendChild(body); 14 | 15 | var checkbox = document.createElement('input'); 16 | checkbox.setAttribute("type", "checkbox"); 17 | checkbox.setAttribute("id", "accordion-" + i); 18 | checkbox.setAttribute("hidden", ""); 19 | 20 | var label = document.createElement('label'); 21 | label.textContent = name.textContent 22 | label.setAttribute("class", "accordion-header c-hand"); 23 | label.setAttribute("for", "accordion-" + i); 24 | 25 | var icon = document.createElement('i'); 26 | icon.setAttribute("class", "icon icon-arrow-down"); 27 | label.appendChild(icon); 28 | 29 | accordion.appendChild(checkbox); 30 | accordion.appendChild(label); 31 | accordion.appendChild(acco_body); 32 | 33 | name.parentNode.replaceChild(accordion, name); 34 | } 35 | 36 | // clear invalid syntax 37 | function clear_invalid_syntax() { 38 | document.querySelectorAll('.book-menu > :not(ul):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6)').forEach((e) => { 39 | e.parentNode.removeChild(e); 40 | }) 41 | } 42 | 43 | // pack accordion 44 | function pack_menu_accordion() { 45 | document.querySelectorAll('.book-menu > ul').forEach((e, idx) => { 46 | var sibling = e.previousElementSibling; 47 | while (sibling != null) { 48 | if (sibling.tagName == "H1" || sibling.tagName == "H2" || 49 | sibling.tagName == "H3" || sibling.tagName == "H4" || 50 | sibling.tagName == "H5" || sibling.tagName == "H6") { 51 | break; 52 | } 53 | sibling = sibling.previousElementSibling; 54 | } 55 | if (!sibling || sibling.tagName == "H1") { 56 | e.classList.add('uncollapsible'); 57 | } 58 | else { 59 | collapse(sibling, e, idx); 60 | } 61 | }) 62 | } 63 | 64 | // highlight current tab 65 | function highlight_current_tab() { 66 | document.querySelectorAll('.book-menu a').forEach((item) => { 67 | if (!item.getAttribute('href')) return // if href has no value 68 | // normalized url 69 | let sharp = window.location.href.search('#'); 70 | let url = window.location.href 71 | if (sharp != -1) { 72 | url = url.slice(0, sharp); 73 | } 74 | if (url.slice(-1) == '/') { 75 | url = url.slice(0, -1); 76 | } 77 | if (item.href === url) { 78 | item.classList.add('current-tab') 79 | var parent = item.parentNode; 80 | while (!parent.classList.contains("book-menu")) { 81 | if (parent.classList.contains("accordion")) { 82 | break; 83 | } 84 | parent = parent.parentNode; 85 | } 86 | if (parent.classList.contains("accordion")) { 87 | parent.querySelector('input').setAttribute("checked", ""); 88 | } 89 | } 90 | }) 91 | } 92 | 93 | function show_sidebar() { 94 | var menu = document.getElementById('menu'); 95 | menu.classList.remove('hide'); 96 | } 97 | 98 | /* ----- onload ----- */ 99 | 100 | clear_invalid_syntax() 101 | pack_menu_accordion() 102 | highlight_current_tab() 103 | show_sidebar() 104 | 105 | // restore sidebar position after reloading page 106 | window.addEventListener('beforeunload', () => { 107 | let sidebarPos = document.querySelector('.book-menu').scrollTop 108 | window.localStorage.setItem('sidebarPos', sidebarPos) 109 | }) 110 | 111 | if (window.localStorage.sidebarPos) { 112 | let sidebarPos = window.localStorage.sidebarPos 113 | document.querySelector('.book-menu').scrollTop = sidebarPos 114 | } -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/js/book-post.js: -------------------------------------------------------------------------------- 1 | // add figcaption under image 2 | document.querySelectorAll('img').forEach(function(img){ 3 | if(img.getAttribute('alt')) { 4 | let parent = img.parentNode; 5 | let figcaption = document.createElement('figcaption'); 6 | figcaption.innerHTML = img.getAttribute('alt'); 7 | parent.insertBefore(figcaption, img.nextSibling); 8 | } 9 | }) 10 | 11 | // add table wrapper 12 | document.querySelectorAll('.book-post > table, li > table').forEach(function(table){ 13 | let parent = table.parentNode; 14 | let wrapper = document.createElement('div'); 15 | wrapper.className = 'table-wrapper' 16 | parent.insertBefore(wrapper, table); 17 | wrapper.appendChild(table); 18 | }) 19 | 20 | // add footnotes tooltips 21 | document.querySelectorAll('sup.footnote-ref').forEach(function(fn){ 22 | let parent = fn.parentNode; 23 | let wrapper = document.createElement('span'); 24 | let link = fn.childNodes[0].getAttribute("href") // #fn1 25 | link = link.substr(1, link.length) // fn1 26 | let fn_content = document.getElementById(link).innerText.replace(/↩/g, '') 27 | wrapper.className = 'tooltip' 28 | wrapper.setAttribute("data-tooltip", fn_content) 29 | parent.insertBefore(wrapper, fn); 30 | wrapper.appendChild(fn); 31 | }) -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/js/book-toc.js: -------------------------------------------------------------------------------- 1 | tocbot.init({ 2 | tocSelector: '.book-tocbot', 3 | contentSelector: '.book-content', 4 | headingSelector: 'h1, h2, h3, h4, h5', 5 | collapseDepth: 2, 6 | orderedList: false, 7 | scrollSmooth: false, 8 | }) 9 | 10 | function expand_toc() { 11 | var b = document.querySelector(".book-toc-expand") 12 | tocbot.init({ 13 | tocSelector: '.book-tocbot', 14 | contentSelector: '.book-content', 15 | headingSelector: 'h1, h2, h3, h4, h5', 16 | collapseDepth: 6, 17 | orderedList: false, 18 | scrollSmooth: false, 19 | }) 20 | b.setAttribute("onclick", "collapse_toc()") 21 | b.innerHTML = "全部收起" 22 | } 23 | 24 | function collapse_toc() { 25 | var b = document.querySelector(".book-toc-expand") 26 | tocbot.init({ 27 | tocSelector: '.book-tocbot', 28 | contentSelector: '.book-content', 29 | headingSelector: 'h1, h2, h3, h4, h5', 30 | collapseDepth: 2, 31 | orderedList: false, 32 | scrollSmooth: false, 33 | }) 34 | b.setAttribute("onclick", "expand_toc()") 35 | b.innerHTML = "全部展开" 36 | } 37 | 38 | function go_top() { 39 | window.scrollTo(0, 0) 40 | setTimeout(update_maxHeight, 150) // wait animation 41 | } 42 | 43 | function go_bottom() { 44 | window.scrollTo(0, document.body.scrollHeight) 45 | setTimeout(update_maxHeight, 150) // wait animation 46 | } 47 | 48 | function get_maxHeight() { 49 | let meta = document.querySelector('.book-post-meta') 50 | let tocbot_menu = document.querySelector('.book-tocbot-menu') 51 | 52 | let meta_pos = (meta == null) ? new DOMRect(0, 0, 0, 0) : meta.getBoundingClientRect() 53 | let tocbot_menu_pos = (tocbot_menu == null) ? new DOMRect(0, 0, 0, 0) : tocbot_menu.getBoundingClientRect() 54 | 55 | let screenHeight = window.innerHeight 56 | let maxHeight = screenHeight - meta_pos.y - meta_pos.height - tocbot_menu_pos.height - screenHeight * 0.15 57 | 58 | return maxHeight 59 | } 60 | 61 | function update_maxHeight() { 62 | let scrollY = window.scrollY 63 | let meta = document.querySelector('.book-post-meta') 64 | let tocbot = document.querySelector('.book-tocbot') 65 | let maxHeight = get_maxHeight() 66 | 67 | if (meta == null) { 68 | tocbot.style.maxHeight = maxHeight + "px" 69 | } 70 | else if (scrollY > 600) { 71 | meta.classList.add('hide') 72 | tocbot.style.maxHeight = maxHeight + "px" 73 | } 74 | else { 75 | meta.classList.remove('hide') 76 | tocbot.style.maxHeight = maxHeight + "px" 77 | } 78 | } 79 | 80 | window.addEventListener('load', () => { 81 | let tocbot = document.querySelector('.book-tocbot') 82 | let maxHeight = get_maxHeight() 83 | tocbot.style.maxHeight = maxHeight + "px" 84 | }) 85 | window.addEventListener('resize', update_maxHeight) 86 | window.addEventListener('scroll', update_maxHeight) -------------------------------------------------------------------------------- /themes/hexo-theme-book/source/js/book.js: -------------------------------------------------------------------------------- 1 | function hide_canvas() { 2 | let sidebar = document.querySelector('.book-sidebar') 3 | let overlay = document.querySelector('.off-canvas-overlay') 4 | sidebar.classList.remove('show') 5 | overlay.classList.remove('show') 6 | } 7 | 8 | function open_sidebar() { 9 | let sidebar = document.querySelector('.book-sidebar') 10 | let overlay = document.querySelector('.off-canvas-overlay') 11 | sidebar.classList.add('show') 12 | overlay.classList.add('show') 13 | } 14 | --------------------------------------------------------------------------------