Skip to content

Commit

Permalink
simplify toc&comment management w/ mdbook-header-footer
Browse files Browse the repository at this point in the history
  • Loading branch information
SichangHe committed Sep 13, 2024
1 parent d415a75 commit a4be277
Show file tree
Hide file tree
Showing 116 changed files with 40 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
lfs: true
- uses: cargo-bins/cargo-binstall@main
- name: Install mdBook, mdBook-KaTeX, and mdBook-ToC
run: cargo binstall -y mdbook mdbook-katex mdbook-toc
run: cargo binstall -y mdbook mdbook-katex mdbook-toc mdbook-header-footer
- name: Install minify-html
run: |
curl -LO https://github.com/wilsonzlin/minify-html/releases/download/v0.15.0/minhtml-0.15.0-x86_64-unknown-linux-gnu
Expand Down
32 changes: 29 additions & 3 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,36 @@ level = 1
copy-js = false
runnable = false

[preprocessor.header-footer]
headers = [{ padding = "<!-- toc -->\n" }]
footers = [
{ regex = "^blogs/", padding = """
[*Steven Hé (Sīchàng)'s Blogs*](/blogs/)
<script src="https://giscus.app/client.js" data-repo="SichangHe/sichanghe.github.io" data-repo-id="R_kgDOJoD14g"
data-category="General" data-category-id="DIC_kwDOJoD14s4CflYo" data-mapping="title" data-strict="1"
data-reactions-enabled="1" data-emit-metadata="0" data-input-position="top" data-theme="preferred_color_scheme"
data-lang="en" data-loading="lazy" crossorigin="anonymous" async>
</script>
""" },
{ regex = "^news/", padding = """
[*News | Steven Hé (Sīchàng)*](/news/)
<script src="https://giscus.app/client.js" data-repo="SichangHe/sichanghe.github.io" data-repo-id="R_kgDOJoD14g"
data-category="General" data-category-id="DIC_kwDOJoD14s4CflYo" data-mapping="title" data-strict="1"
data-reactions-enabled="1" data-emit-metadata="0" data-input-position="top" data-theme="preferred_color_scheme"
data-lang="en" data-loading="lazy" crossorigin="anonymous" async>
</script>
""" },
]
before = ["links", "toc"]

[preprocessor.toc]
before = ["katex"]

[preprocessor.katex]
after = ["links"]
include-src = true
throw-on-error = false

[preprocessor.toc]
before = ["katex"]
2 changes: 1 addition & 1 deletion linked/JSphere
Submodule JSphere updated 2 files
+0 −1 literature.md
+0 −1 sketch.md
1 change: 0 additions & 1 deletion src/about.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# About

## Contact
Expand Down
3 changes: 0 additions & 3 deletions src/blogs/300x_speed_up.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# ~300× Speed Up in Rust: Finding Inexact Matches in Nested Sets

I optimized my route analyzer to get 300× faster.
Expand Down Expand Up @@ -501,8 +500,6 @@ prefixes][flamegraph-use-routes-for-each-as]][flamegraph-use-routes-for-each-as]

Started *2024-05-30*, finished *2024-07-29*.

{{ #include footer.md }}

[Cargo-FlameGraph]: https://github.com/flamegraph-rs/flamegraph
[flamegraph-after]: https://github.com/SichangHe/internet_route_verification/assets/84777573/33a7354f-a47a-4c8f-a905-c717bbd38f62
[flamegraph-before]: https://github.com/SichangHe/internet_route_verification/assets/84777573/6a869975-a764-45f8-9f14-a27498f3e1f8
Expand Down
2 changes: 0 additions & 2 deletions src/blogs/deprecated/how_did_we.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- toc -->

# How did we get here? WordPress?

This was when I set up the blog in WordPress.
Expand Down
2 changes: 0 additions & 2 deletions src/blogs/deprecated/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- toc -->

# Deprecated

These entries are stored only for the history.
3 changes: 0 additions & 3 deletions src/blogs/footer.md

This file was deleted.

2 changes: 0 additions & 2 deletions src/blogs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- toc -->

<div style="display: flex; align-items: center;">
<img alt="Steven Hé (Sīchàng)'s avatar" style="width: calc(100% - 30em); height: auto; max-width: 100%;"
src="/favicon.svg" />
Expand Down
1 change: 0 additions & 1 deletion src/blogs/learning_async_rust_wrong.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# We are Learning Async Rust Wrong
<!-- TODO: Change to "I was?" -->

Expand Down
4 changes: 0 additions & 4 deletions src/blogs/perfect_grayscale.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- toc -->

# Creating Perfect Grayscale-Gradient Colormaps

<style>
Expand Down Expand Up @@ -208,5 +206,3 @@ Can you solve the system for $r,g,b$ given $h,s,p$?
---

*2024-05-25*

{{ #include footer.md }}
3 changes: 0 additions & 3 deletions src/blogs/what_does_mdbook.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->

# What an mdBook Preprocessor Does—Code Walk-through of mdBook-KaTeX

Expand Down Expand Up @@ -304,5 +303,3 @@ We will talk about the mess mdBook-KaTeX was in next time.
---
*2023-05-27*, edited: *2023-06-11*, *2024-05-24*
{{ #include footer.md }}
2 changes: 0 additions & 2 deletions src/blogs/why_was_mdbook.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- toc -->

<!-- TODO: This is a draft. -->

# Why Was mdBook-KaTeX in a Mess and How did I Clean It Up—Celebrating mdBook-KaTeX v0.5
Expand Down
1 change: 0 additions & 1 deletion src/diary/back_from_duke.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Back from Duke

20230313
Expand Down
1 change: 0 additions & 1 deletion src/diary/elixir_phoenix.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Elixir Phoenix

I need a back end technology.
Expand Down
1 change: 0 additions & 1 deletion src/diary/feeling_lost.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Feeling Lost

2022-05-15
Expand Down
1 change: 0 additions & 1 deletion src/diary/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Diary

Guests: don't read this. This is private.
1 change: 0 additions & 1 deletion src/diary/linux_vm_and_neovim.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Linux VM And Neovim

20220806
Expand Down
1 change: 0 additions & 1 deletion src/diary/mdbook_katex.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# `mdbook-katex`

20230315
Expand Down
1 change: 0 additions & 1 deletion src/diary/spring_2024_activities/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Spring 2024 Activities

*2023-03-28*
Expand Down
1 change: 0 additions & 1 deletion src/diary/spring_2024_ideas.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Spring 2024 Ideas
1 change: 0 additions & 1 deletion src/diary/spring_2024_ideas/rethinking_the_web.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Rethinking The Web

## Browser space
Expand Down
1 change: 0 additions & 1 deletion src/diary/spring_2024_ideas/rust.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Rust

## Threads & Async & Coroutines & Lunatics
Expand Down
1 change: 0 additions & 1 deletion src/diary/start.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# start

*2022-03-17*
Expand Down
1 change: 0 additions & 1 deletion src/diary/the_run.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# The Run

2022-05-08
Expand Down
1 change: 0 additions & 1 deletion src/diary/vscodium.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# VSCodium

*2022-04-04*
Expand Down
5 changes: 0 additions & 5 deletions src/giscus.md

This file was deleted.

2 changes: 0 additions & 2 deletions src/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- toc -->

# Steven Hé (Sīchàng)

<div
Expand Down
1 change: 0 additions & 1 deletion src/news/2024fall.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
<!-- markdownlint-disable-file first-line-h1 -->
### 2024 Fall

Expand Down
1 change: 0 additions & 1 deletion src/news/2024spring.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
<!-- markdownlint-disable-file first-line-h1 -->
### 2024 Spring

Expand Down
1 change: 0 additions & 1 deletion src/notes/automation_software/cli_util.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Command-Line Utilities

wrap lines to a maximum width of 80 in FILE
Expand Down
1 change: 0 additions & 1 deletion src/notes/automation_software/hammerspoon.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Hammerspoon

add stuff: open config, type in LaTeX, save, reload config
Expand Down
1 change: 0 additions & 1 deletion src/notes/automation_software/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Automation Software
1 change: 0 additions & 1 deletion src/notes/class_notes/cs201.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Introduction to Programming and Data Structures

**encryption**
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/cs301.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Algorithms and Databases

# sort
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/cs304.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Speech Recognition

broader speech processing
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/cs310.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Introduction to Databases

information: data with meaning
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/cs401.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Cloud Computing

operational expense (OPEX), capital expense (CAPEX) → centralize server
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/cs402.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Artificial Intelligence

most supervised learning when ppl talk about
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/csci651.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Advanced Computer Networking

40 paper + 20hr+ programming project + similar research project
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/csci670.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Advanced Analysis of Algorithms

6hw + 3qz + 2 theoretical thinking project
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Unstructured Class Notes

some of these are generated from old `docx` file using Pandoc
1 change: 0 additions & 1 deletion src/notes/class_notes/math202.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Linear Algebra

linear system: $\left\{\begin{array}{r}
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/math205.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Probability and Statistics

*x*⌋= the greatest integer smaller than *x*
Expand Down
1 change: 0 additions & 1 deletion src/notes/class_notes/stats210.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Probability, Random Variables, and Stochastic Processes

## joint distribution: discrete
Expand Down
1 change: 0 additions & 1 deletion src/notes/cs/discrete_math.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Discrete Mathematics for Computer Science

## proof by induction
Expand Down
1 change: 0 additions & 1 deletion src/notes/cs/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Computer Science
3 changes: 1 addition & 2 deletions src/notes/cs/machine_learning.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Machine Learning

## general problem format
Expand Down Expand Up @@ -451,4 +450,4 @@ $K$ is a kernel of $\{\vec x_i\}$
K(\vec x,\vec\xi)=e^{-\frac{\|\vec x-\vec\xi\|^2}{\sigma^2}}
$$

- radial basis function (RBF) SVM
- radial basis function (RBF) SVM
1 change: 0 additions & 1 deletion src/notes/cs/networking.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Networking

# encoding/decoding
Expand Down
1 change: 0 additions & 1 deletion src/notes/data_science/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Data Science
1 change: 0 additions & 1 deletion src/notes/data_science/visualization.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Visualization

# data type
Expand Down
1 change: 0 additions & 1 deletion src/notes/documentation/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Documentation
1 change: 0 additions & 1 deletion src/notes/documentation/pandoc.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Pandoc

[How to use Pandoc to produce a research paper](https://opensource.com/article/18/9/pandoc-research-paper)
Expand Down
1 change: 0 additions & 1 deletion src/notes/exams/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Exams
1 change: 0 additions & 1 deletion src/notes/exams/toefl.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# TOEFL

## reading
Expand Down
1 change: 0 additions & 1 deletion src/notes/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- toc -->
# Steven Hé (Sīchàng)'s Notes
1 change: 0 additions & 1 deletion src/notes/macos/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# macOS

get ID of app:
Expand Down
1 change: 0 additions & 1 deletion src/notes/macos/sucklessfy.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Sucklessfy

allow apps from anywhere
Expand Down
1 change: 0 additions & 1 deletion src/notes/mathematics/abstract_algebra.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Abstract Algebra

# integer
Expand Down
3 changes: 1 addition & 2 deletions src/notes/mathematics/analysis.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Real Analysis

# set
Expand Down Expand Up @@ -812,4 +811,4 @@ $$

- $f(x)\in C^∞ (x_0-R,x_0+R)$
- $f'(x)=\sum_{j=0}^∞ (a_j(x-x_0)^j)'$
- $\sum_{j=0}^∞ a_j(x-x_0)^j$ is Taylor series of $f$ about $x_0$
- $\sum_{j=0}^∞ a_j(x-x_0)^j$ is Taylor series of $f$ about $x_0$
1 change: 0 additions & 1 deletion src/notes/mathematics/arithmetics.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Arithmetics

$$
Expand Down
1 change: 0 additions & 1 deletion src/notes/mathematics/calculus.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Calculus

# function
Expand Down
1 change: 0 additions & 1 deletion src/notes/mathematics/complex_analysis.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Complex Analysis

# complex number $\mathbb C$
Expand Down
1 change: 0 additions & 1 deletion src/notes/mathematics/complex_function.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Complex function

# logarithm
Expand Down
1 change: 0 additions & 1 deletion src/notes/mathematics/complex_sequence_series.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!-- toc -->
# Complex Sequence and Series

# sequence
Expand Down
Loading

0 comments on commit a4be277

Please sign in to comment.