Skip to content

Commit 4975427

Browse files
✏️ Fix docs and contributing typos (#4)
* ✨ Added some missing features to the default theme * ✏️ Fixed docs and contributing typos * 🚧 Attempted to add examples * 🚧 Gave up on the examples * 📝 Finished the docs overhaul * 📝 Made the headings easier to differentiate * 📝 Improved the documentation for the create-entry functions * 📝 Rerendered the docs * 📝 Fixed formatting of raw blocks --------- Co-authored-by: BattleCh1cken <BattleCh1cken@larkov.de>
1 parent a1a14b2 commit 4975427

File tree

8 files changed

+161
-35
lines changed

8 files changed

+161
-35
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ All types of contributions are encouraged and valued. See the [Table of Contents
2222
- [Suggesting Enhancements](#suggesting-enhancements)
2323
- [Your First Code Contribution](#your-first-code-contribution)
2424
- [Improving The Documentation](#improving-the-documentation)
25-
- [Styleguides](#style-guides)
25+
- [Style Guides](#style-guides)
2626
- [Typst Code](#typst-code)
2727
- [Commit Messages](#commit-messages)
2828

docs-template.typ

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,34 @@
1616
set page(numbering: "1", number-align: center)
1717
set text(font: "Linux Libertine", lang: "en")
1818

19-
show heading.where(level: 1): it => block(smallcaps(it), below: 1em)
19+
show heading: it => {
20+
if it.level == 1 {
21+
set align(left)
22+
set text(20pt)
23+
box(it)
24+
box(line(length: 100%))
25+
} else if it.level == 2 {
26+
set text(18pt)
27+
it
28+
} else if it.level == 3 {
29+
set text(15pt)
30+
it
31+
} else if it.level == 4 {
32+
set text(14pt)
33+
it
34+
} else if it.level == 5 {
35+
set text(12pt)
36+
it.body
37+
} else if it.level == 6 {
38+
set text(12pt)
39+
it.body
40+
} else {
41+
panic("invalid heading level")
42+
}
43+
}
44+
2045
set heading(numbering: "1.")
2146

22-
// show link: set text(fill: purple.darken(30%))
2347
show link: set text(fill: rgb("#1e8f6f"))
2448
show link: underline
2549

@@ -62,13 +86,15 @@
6286
v(10em)
6387

6488
show: codly-init
65-
codly()
89+
codly(enable-numbers: false)
90+
6691
show raw.where(block: true): set text(size: .95em)
6792
show raw.where(block: true): it => pad(x: 4%, it)
6893

94+
//FIXME: make this work again
6995
show raw.where(block: false): it => if it.text.starts-with("<") and it.text.ends-with(">") {
7096
set text(1.2em)
71-
tidy.styles.default.show-type(it.text.slice(1, -1))
97+
tidy.styles.default.show-type(it.text.slice(1, -1), style-args: tidy.styles.default)
7298
} else {
7399
it
74100
}

docs.pdf

29.8 KB
Binary file not shown.

docs.typ

Lines changed: 86 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
#import "./docs-template.typ": *
2-
#import "./packages.typ": tidy
3-
2+
#import "./packages.typ": tidy, gentle-clues
3+
#import gentle-clues: *
44

55
#let version = toml("/typst.toml").package.version
66
#let import-statement = "#import \"@preview/tidy:" + version + "\""
77

88
#show: docs-template.with(
9-
title: "The Notebookinator", subtitle: "Easy formatting for robotics notebooks.", abstract: [
10-
Welcome to the Notebookinator, a Typst package meant to simply the notebooking
9+
title: "The Notebookinator",
10+
subtitle: "Easy formatting for robotics notebooks.",
11+
abstract: [
12+
Welcome to the Notebookinator, a Typst package meant to simplify the notebooking
1113
process for the Vex Robotics Competition. Its theming capabilities handle all of
1214
the styling for you, letting you jump right into writing documentation.
1315

1416
While it was designed with VRC in mind, it could just as easily be used for
1517
other competitor systems such as the First Robotics Competition and the First
1618
Tech Challenge.
17-
], version: version, url: "https://github.com/BattleCh1cken/notebookinator",
19+
],
20+
version: version,
21+
url: "https://github.com/BattleCh1cken/notebookinator",
1822
)
1923

2024
#outline(indent: true, depth: 3)
2125
#pagebreak(weak: true)
2226

2327
= Installation
2428

29+
#info[
30+
This installation process is temporary, as we wait for Typst to overhaul its
31+
process for packaging templates and packages.
32+
]
33+
2534
The best way to install the Notebookinator is as a local package. Make sure you
2635
have the following software installed on your computer:
2736

@@ -38,28 +47,35 @@ cd notebookinator
3847
just install
3948
```
4049

50+
#info[
51+
If you're running this on Windows, you'll need to run these commands in a sh
52+
shell, like git-bash or the shell packaged with Cygwin or GitHub Desktop.
53+
]
54+
4155
= Basic Usage
4256

4357
Once the template is installed, you can import it into your project like this:
4458

4559
#raw(
4660
block: true,
4761
lang: "typ",
48-
"#import \"@local/notebookinator:"+ version + "\": *"
62+
"#import \"@local/notebookinator:" + version + "\": *",
4963
)
5064

5165
Once you've done that you can begin to write your notebook:
66+
5267
```typ
5368
#import themes.default: default-theme, components
5469
5570
#show: notebook.with(theme: default-theme)
5671
5772
#create-body-entry(title: "My Entry")[
58-
#lorem(200)
73+
#lorem(200)
5974
]
6075
```
6176

6277
You can then compile your notebook with the Typst CLI:
78+
6379
```bash
6480
typst compile your-notebook-file.typ
6581
```
@@ -88,20 +104,35 @@ typst compile your-notebook-file.typ
88104
Themes are stored as dictionaries with a set number of fields.
89105

90106
#def-arg(
91-
"rules", [`<function>`], default: none, [ The show and set rules that will be applied to the document ],
107+
"rules",
108+
[`<function>`],
109+
default: none,
110+
[ The show and set rules that will be applied to the document ],
92111
)
93112
#def-arg(
94-
"cover", [`<function>`], default: none, [ A function that returns the cover of the notebook. Must take context as input. ],
113+
"cover",
114+
[`<function>`],
115+
default: none,
116+
[ A function that returns the cover of the notebook. Must take context as input. ],
95117
)
96118
#def-arg(
97-
"frontmatter-entry", [`<function>`], default: none, [ A function that returns a frontmatter entry. Must take context and body as
119+
"frontmatter-entry",
120+
[`<function>`],
121+
default: none,
122+
[ A function that returns a frontmatter entry. Must take context and body as
98123
input. ],
99124
)
100125
#def-arg(
101-
"body-entry", [`<function>`], default: none, [ A function that returns a body entry. Must take context and body as input. ],
126+
"body-entry",
127+
[`<function>`],
128+
default: none,
129+
[ A function that returns a body entry. Must take context and body as input. ],
102130
)
103131
#def-arg(
104-
"appendix-entry", [`<function>`], default: none, [ A function that returns a appendix entry. Must take context and body as input. ],
132+
"appendix-entry",
133+
[`<function>`],
134+
default: none,
135+
[ A function that returns a appendix entry. Must take context and body as input. ],
105136
)
106137

107138
=== Context <context>
@@ -112,20 +143,46 @@ Context is stored as a dictionary with the following fields:
112143

113144
#def-arg("title", [`<string>`], default: none, [The title of the entry])
114145
#def-arg(
115-
"type", [`<string>` or `<none>`], default: none, [The type of the entry. This value is used differently by different templates.
146+
"type",
147+
[`<string>` or `<none>`],
148+
default: none,
149+
[The type of the entry. This value is used differently by different templates.
116150
Refer to the template level documentation to see what this means for your theme.],
117151
)
118152
#def-arg(
119-
"start-date", [`<datetime>`], default: none, [The date at which the entry started.],
153+
"start-date",
154+
[`<datetime>`],
155+
default: none,
156+
[The date at which the entry started.],
120157
)
121158
#def-arg(
122-
"end-date", [`<datetime>`], default: none, [The date at which the entry ended.],
159+
"end-date",
160+
[`<datetime>`],
161+
default: none,
162+
[The date at which the entry ended.],
123163
)
124164
#def-arg(
125-
"page-number", [`<integer>` or `<none>`], default: none, [The page number of the first page of the entry. Only available while using the `print-toc()` utility
126-
function. ],
165+
"page-number",
166+
[`<integer>` or `<none>`],
167+
default: none,
168+
[The page number of the first page of the entry. Only available while using the
169+
`print-toc()` utility function. ],
127170
)
128171

172+
== Default Theme
173+
174+
The default theme.
175+
176+
#warning[
177+
This theme is very minimal, and is generally intended as a fallback for stuff
178+
that other themes don't implement.
179+
]
180+
181+
=== Components
182+
183+
#let default-components-module = tidy.parse-module(read("./themes/default/components.typ"))
184+
#show-module(default-components-module, first-heading-level: 3)
185+
129186
== Radial Theme
130187

131188
The Radial theme is a minimal theme focusing on nice, rounded corners.
@@ -149,6 +206,10 @@ types are available:
149206
Minimal starting point:
150207

151208
```typ
209+
// Import the template and theme here
210+
211+
#show: notebook.with(theme: radial-theme)
212+
152213
#create-frontmatter-entry(title: "Table of Contents")[
153214
#components.toc()
154215
]
@@ -186,7 +247,7 @@ Minimal starting point:
186247
for name in names.pos() {
187248
read(predicate + name + ".typ")
188249
}
189-
}
250+
}
190251

191252
=== Components
192253

@@ -219,7 +280,7 @@ types are available:
219280
- `"brainstorm"`: For entries about the brainstorm stage of the engineering design
220281
process.
221282
- `"decide"`: For entries about the decide stage of the engineering design
222-
process.
283+
process/
223284
- `"build"`: For entries about the build stage of the engineering design process.
224285
- `"program"`: For entries about the programming stage of the engineering design
225286
process.
@@ -234,7 +295,7 @@ Minimal starting point:
234295
235296
#create-body-entry(title: "Day 1", type: "identify", date: datetime(year: 1984, month: 1, day: 1))[
236297
= Heading
237-
298+
238299
#lorem(50)
239300
240301
#components.pro-con(
@@ -257,7 +318,7 @@ Minimal starting point:
257318
258319
#create-body-entry(title: "Day 2", type: "identify", date: datetime(year: 1984, month: 1, day: 2))[
259320
= Another Heading
260-
321+
261322
#lorem(50)
262323
263324
#components.decision-matrix(
@@ -343,8 +404,8 @@ guidelines, check our `CONTRIBUTING.MD` file in our GitHub.
343404
This section of the document covers how to add your own theme to the template.
344405
The first thing you'll have to do is create the entry point for your theme.
345406
Create a new directory inside the `themes/` directory, then create a Typst
346-
source file inside of that directory. For example, if you had a theme called `foo`,
347-
the path to your entry point would look like this: `themes/foo/foo.typ`.
407+
source file inside of that directory. For example, if you had a theme called
408+
`foo`, the path to your entry point would look like this: `themes/foo/foo.typ`.
348409

349410
Once you do this, you'll have to add your theme to the `themes/themes.typ` file
350411
like this:
@@ -445,8 +506,8 @@ Once you define all of your functions you'll have to actually define your theme.
445506
The theme is just a dictionary which stores all of the functions that you just
446507
defined.
447508

448-
The theme should be defined in your theme's entry point (`themes/foo/foo.typ` for
449-
this example).
509+
The theme should be defined in your theme's entry point (`themes/foo/foo.typ`
510+
for this example).
450511

451512
Here's what the theme would look like in this scenario:
452513

entries.typ

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,41 @@
5050
}
5151

5252
/// Variant of the `#create-entry()` function that creates a frontmatter entry.
53+
///
54+
/// *Example Usage:*
55+
///
56+
/// ```typ
57+
/// #create-frontmatter-entry(title: "Title")[
58+
/// #lorem(50)
59+
/// ]
60+
/// ```
61+
///
5362
#let create-frontmatter-entry = create-entry.with(section: "frontmatter")
5463

5564
/// Variant of the `#create-entry()` function that creates a body entry.
65+
///
66+
/// *Example Usage:*
67+
///
68+
/// ```typ
69+
/// #create-body-entry(
70+
/// title: "Title",
71+
/// date: datetime(year: 2024, month: 1, day: 1),
72+
/// type: "identify", // Change this depending on what your theme allows
73+
/// author: "Bobert",
74+
/// witness: "Bobernius",
75+
/// )[
76+
/// #lorem(50)
77+
/// ]
78+
/// ```
5679
#let create-body-entry = create-entry.with(section: "body")
5780

5881
/// Variant of the `#create-entry()` function that creates an appendix entry.
82+
///
83+
/// *Example Usage:*
84+
///
85+
/// ```typ
86+
/// #create-appendix-entry(title: "Title")[
87+
/// #lorem(50)
88+
/// ]
89+
/// ```
5990
#let create-appendix-entry = create-entry.with(section: "appendix")

packages.typ

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#import "@preview/tidy:0.1.0"
1+
#import "@preview/tidy:0.2.0"
22
#import "@preview/codly:0.2.0"
33
#import "@preview/tablex:0.0.8"
44
#import "@preview/showybox:2.0.1"
55
#import "@preview/timeliney:0.0.1"
66
#import "@preview/cetz:0.2.0"
7+
#import "@preview/gentle-clues:0.6.0"

themes/radial/components/admonitions.typ

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
/// A message in a colored box meant to draw the reader's attention.
99
///
10+
///
1011
/// - type (string): The type of admonition.
1112
/// Available types include:
1213
/// - "note"
@@ -23,10 +24,16 @@
2324

2425
showybox(
2526
frame: (
26-
border-color: info.color, body-color: info.color.lighten(80%), thickness: (left: 4pt), radius: 1.5pt,
27-
), [
27+
border-color: info.color,
28+
body-color: info.color.lighten(80%),
29+
thickness: (left: 4pt),
30+
radius: 1.5pt,
31+
),
32+
[
2833
#text(
29-
size: 15pt, fill: info.color, [
34+
size: 15pt,
35+
fill: info.color,
36+
[
3037
#box(baseline: 30%, image.decode(colored-icon, width: 1.5em)) *#info.title*
3138
],
3239
)

themes/radial/components/pro-con.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#import "../colors.typ": *
1+
#include "../colors.typ"
22

33
/// A table displaying pros and cons.
44
///

0 commit comments

Comments
 (0)