Skip to content

Commit af6c605

Browse files
authored
Merge pull request mainmatter#133 from mainmatter/style-book
Style book
2 parents f613c9a + 0ca42ba commit af6c605

File tree

3 files changed

+269
-13
lines changed

3 files changed

+269
-13
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ jobs:
1515
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
repository: mainmatter/core-sans-a-fonts
22+
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
23+
path: core-sans-a-fonts
24+
- name: Install Fonts
25+
run: |
26+
sudo cp -r core-sans-a-fonts/* /usr/local/share/fonts/
27+
sudo fc-cache -f -v
28+
fc-list | grep "Core Sans"
1829
- uses: actions-rust-lang/setup-rust-toolchain@v1
1930
- name: Install exercise plugin
2031
run: cargo install --path helpers/mdbook-exercise-linker

book/book.toml

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,40 @@ show-hidden-lines = true
2828
[output.pandoc.profile.pdf] # options to pass to Pandoc (see https://pandoc.org/MANUAL.html)
2929
output-file = "100-exercises-to-learn-rust.pdf"
3030
to = "latex"
31-
highlight-style = "tango"
31+
highlight-style = "./custom.theme"
3232
# We use `lualatext` because, right now, it's the only engine
3333
# that supports fallback fonts, which we need for emojis.
3434
pdf-engine = "lualatex"
3535
metadata-file = "metadata.yml"
3636

3737
[output.pandoc.profile.pdf.variables]
38+
mainfont = "CoreSansA45.ttf"
39+
mainfontoptions = [
40+
"BoldFont=CoreSansA65.ttf",
41+
"ItalicFont=CoreSansA45It.ttf",
42+
"BoldItalicFont=CoreSansA65It.ttf",
43+
]
44+
sansfont = "CoreSansA45.ttf"
45+
sansfontoptions = [
46+
"BoldFont=CoreSansA65.ttf",
47+
"ItalicFont=CoreSansA45It.ttf",
48+
"BoldItalicFont=CoreSansA65It.ttf",
49+
]
3850
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
39-
mainfont = "Noto Serif"
40-
sansfont = "Noto Sans"
4151
monofont = "Noto Sans Mono"
4252
mainfontfallback = ["Noto Color Emoji:mode=harf"]
4353
sansfontfallback = ["Noto Color Emoji:mode=harf"]
4454
monofontfallback = [
4555
"Noto Color Emoji:mode=harf",
4656
]
47-
linkcolor = "blue"
48-
urlcolor = "blue"
57+
linkcolor = "Links"
58+
urlcolor = "Links"
4959
urlstyle = "rm"
5060
documentclass = "book"
51-
fontsize = "11pt"
61+
fontsize = "10pt"
5262
geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.4cm,right=2.4cm"
5363
header-includes = [
64+
"\\definecolor{Links}{HTML}{6200EE}",
5465
# Reduce font size of code blocks
5566
"\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}",
5667
]
@@ -65,20 +76,33 @@ metadata-file = "metadata.yml"
6576
pdf-engine = "lualatex"
6677

6778
[output.pandoc.profile.paperback.variables]
79+
mainfont = "CoreSansA45.ttf"
80+
mainfontoptions = [
81+
"BoldFont=CoreSansA65.ttf",
82+
"ItalicFont=CoreSansA45It.ttf",
83+
"BoldItalicFont=CoreSansA65It.ttf",
84+
]
85+
sansfont = "CoreSansA45.ttf"
86+
sansfontoptions = [
87+
"BoldFont=CoreSansA65.ttf",
88+
"ItalicFont=CoreSansA45It.ttf",
89+
"BoldItalicFont=CoreSansA65It.ttf",
90+
]
6891
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
69-
mainfont = "Noto Serif"
70-
sansfont = "Noto Sans"
7192
monofont = "Noto Sans Mono"
7293
mainfontfallback = ["Noto Color Emoji:mode=harf"]
7394
sansfontfallback = ["Noto Color Emoji:mode=harf"]
7495
monofontfallback = [
7596
"Noto Color Emoji:mode=harf",
7697
]
98+
linkcolor = "Links"
99+
urlcolor = "Links"
77100
urlstyle = "rm"
78101
documentclass = "book"
79-
fontsize = "11pt"
102+
fontsize = "10pt"
80103
geometry = "papersize={8in,10in},top=2cm,bottom=2cm,left=2.8cm,right=2.5cm"
81104
header-includes = [
105+
"\\definecolor{Links}{HTML}{6200EE}",
82106
# Reduce font size of code blocks
83107
"\\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\\\\{\\},fontsize=\\small}",
84108
]
@@ -95,15 +119,25 @@ standalone = true
95119
metadata-file = "metadata.yml"
96120

97121
[output.pandoc.profile.html.variables]
122+
mainfont = "CoreSansA45.ttf"
123+
mainfontoptions = [
124+
"BoldFont=CoreSansA65.ttf",
125+
"ItalicFont=CoreSansA45It.ttf",
126+
"BoldItalicFont=CoreSansA65It.ttf",
127+
]
128+
sansfont = "CoreSansA45.ttf"
129+
sansfontoptions = [
130+
"BoldFont=CoreSansA65.ttf",
131+
"ItalicFont=CoreSansA45It.ttf",
132+
"BoldItalicFont=CoreSansA65It.ttf",
133+
]
98134
# You can get these fonts here: https://fonts.google.com/selection?query=noto+color+
99-
mainfont = "Noto Serif"
100-
sansfont = "Noto Sans"
101135
monofont = "Noto Sans Mono"
102136
mainfontfallback = ["Noto Color Emoji:mode=harf"]
103137
sansfontfallback = ["Noto Color Emoji:mode=harf"]
104138
monofontfallback = [
105139
"Noto Color Emoji:mode=harf",
106140
]
107-
linkcolor = "blue"
108-
urlcolor = "blue"
141+
linkcolor = "Links"
142+
urlcolor = "Links"
109143
urlstyle = "rm"

book/custom.theme

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
{
2+
"text-color": "#c9d1d9",
3+
"background-color": "#343942",
4+
"line-number-color": null,
5+
"line-number-background-color": null,
6+
"text-styles": {
7+
"Alert": {
8+
"text-color": "#ff0000",
9+
"background-color": null,
10+
"bold": true,
11+
"italic": false,
12+
"underline": false
13+
},
14+
"Annotation": {
15+
"text-color": "#8b949e",
16+
"background-color": null,
17+
"bold": true,
18+
"italic": true,
19+
"underline": false
20+
},
21+
"Attribute": {
22+
"text-color": "#03DAC5",
23+
"background-color": null,
24+
"bold": false,
25+
"italic": false,
26+
"underline": false
27+
},
28+
"BaseN": {
29+
"text-color": "#a5d6ff",
30+
"background-color": null,
31+
"bold": false,
32+
"italic": false,
33+
"underline": false
34+
},
35+
"BuiltIn": {
36+
"text-color": "#03DAC5",
37+
"background-color": null,
38+
"bold": false,
39+
"italic": false,
40+
"underline": false
41+
},
42+
"Char": {
43+
"text-color": "#a5d6ff",
44+
"background-color": null,
45+
"bold": false,
46+
"italic": false,
47+
"underline": false
48+
},
49+
"Comment": {
50+
"text-color": "#8b949e",
51+
"background-color": null,
52+
"bold": false,
53+
"italic": true,
54+
"underline": false
55+
},
56+
"CommentVar": {
57+
"text-color": "#8b949e",
58+
"background-color": null,
59+
"bold": true,
60+
"italic": true,
61+
"underline": false
62+
},
63+
"Constant": {
64+
"text-color": "#79c0ff",
65+
"background-color": null,
66+
"bold": false,
67+
"italic": false,
68+
"underline": false
69+
},
70+
"ControlFlow": {
71+
"text-color": "#03DAC5",
72+
"background-color": null,
73+
"bold": true,
74+
"italic": false,
75+
"underline": false
76+
},
77+
"DataType": {
78+
"text-color": "#8b949e",
79+
"background-color": null,
80+
"bold": false,
81+
"italic": false,
82+
"underline": false
83+
},
84+
"DecVal": {
85+
"text-color": "#79c0ff",
86+
"background-color": null,
87+
"bold": false,
88+
"italic": false,
89+
"underline": false
90+
},
91+
"Documentation": {
92+
"text-color": "#8b949e",
93+
"background-color": null,
94+
"bold": false,
95+
"italic": true,
96+
"underline": false
97+
},
98+
"Error": {
99+
"text-color": "#ff0000",
100+
"background-color": null,
101+
"bold": true,
102+
"italic": false,
103+
"underline": false
104+
},
105+
"Extension": {
106+
"text-color": null,
107+
"background-color": null,
108+
"bold": false,
109+
"italic": false,
110+
"underline": false
111+
},
112+
"Float": {
113+
"text-color": "#79c0ff",
114+
"background-color": null,
115+
"bold": false,
116+
"italic": false,
117+
"underline": false
118+
},
119+
"Function": {
120+
"text-color": "#d2a8ff",
121+
"background-color": null,
122+
"bold": false,
123+
"italic": false,
124+
"underline": false
125+
},
126+
"Import": {
127+
"text-color": "#8b949e",
128+
"background-color": null,
129+
"bold": true,
130+
"italic": false,
131+
"underline": false
132+
},
133+
"Information": {
134+
"text-color": "#8b949e",
135+
"background-color": null,
136+
"bold": true,
137+
"italic": true,
138+
"underline": false
139+
},
140+
"Keyword": {
141+
"text-color": "#03DAC5",
142+
"background-color": null,
143+
"bold": true,
144+
"italic": false,
145+
"underline": false
146+
},
147+
"Operator": {
148+
"text-color": "#03DAC5",
149+
"background-color": null,
150+
"bold": false,
151+
"italic": false,
152+
"underline": false
153+
},
154+
"Other": {
155+
"text-color": "#007020",
156+
"background-color": null,
157+
"bold": false,
158+
"italic": false,
159+
"underline": false
160+
},
161+
"Preprocessor": {
162+
"text-color": "#03DAC5",
163+
"background-color": null,
164+
"bold": false,
165+
"italic": false,
166+
"underline": false
167+
},
168+
"SpecialChar": {
169+
"text-color": "#03DAC5",
170+
"background-color": null,
171+
"bold": false,
172+
"italic": false,
173+
"underline": false
174+
},
175+
"SpecialString": {
176+
"text-color": "#03DAC5",
177+
"background-color": null,
178+
"bold": false,
179+
"italic": false,
180+
"underline": false
181+
},
182+
"String": {
183+
"text-color": "#a5d6ff",
184+
"background-color": null,
185+
"bold": false,
186+
"italic": false,
187+
"underline": false
188+
},
189+
"Variable": {
190+
"text-color": "#a8daff",
191+
"background-color": null,
192+
"bold": false,
193+
"italic": false,
194+
"underline": false
195+
},
196+
"VerbatimString": {
197+
"text-color": "#a5d6ff",
198+
"background-color": null,
199+
"bold": false,
200+
"italic": false,
201+
"underline": false
202+
},
203+
"Warning": {
204+
"text-color": "#60a0b0",
205+
"background-color": null,
206+
"bold": true,
207+
"italic": true,
208+
"underline": false
209+
}
210+
}
211+
}

0 commit comments

Comments
 (0)