Skip to content

Commit ab60c2d

Browse files
wardenxyzelegaanz
andauthored
xyznote:0.3.0 (#1489)
Co-authored-by: Ana Gelez <[email protected]>
1 parent 83cf161 commit ab60c2d

File tree

9 files changed

+1552
-0
lines changed

9 files changed

+1552
-0
lines changed

packages/preview/xyznote/0.3.0/LICENSE

+674
Large diffs are not rendered by default.
+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Typst note template
2+
3+
Simple and Functional Typst Note Template
4+
5+
This template is designed for efficient and organized note-taking with Typst. It provides a clean and straightforward structure, making it easy to capture and organize your thoughts without unnecessary complexity.
6+
7+
## Usage
8+
9+
```typ
10+
#import "@preview/xyznote:0.3.0": *
11+
12+
#show: xyznote.with(
13+
title: "xyznote",
14+
author: "wardenxyz",
15+
abstract: "A simple typst note template",
16+
createtime: "2024-11-27",
17+
lang: "zh",
18+
bibliography-style: "ieee",
19+
preface: [], //Annotate this line to delete the preface page.
20+
bibliography-file: bibliography("refs.bib"), //Annotate this line to delete the bibliography page.
21+
)
22+
```
23+
24+
## Features
25+
26+
- **PDF Metadata**: Includes fields for title, author and date.
27+
28+
- **Table of Contents**: Automatically generated ToC for easy navigation through the document.
29+
30+
- **References (Optional)**: A dedicated section for citing sources and references. Include this only if you need it.
31+
32+
## Custom styles
33+
34+
```typ
35+
#tipbox[
36+
contents
37+
]
38+
```
39+
40+
```typ
41+
#markbox[
42+
contents
43+
]
44+
```
45+
46+
```typ
47+
#sectionline
48+
```
49+
50+
```typ
51+
This is #highlight(fill: blue.C)[highlighted in blue].
52+
53+
This is #highlight(fill: yellow.C)[highlighted in yellow].
54+
55+
This is #highlight(fill: green.C)[highlighted in green].
56+
57+
This is #highlight(fill: red.C)[highlighted in red].
58+
```
59+
60+
```typ
61+
#brainstorming[
62+
This is a brainstorming.
63+
]
64+
```
65+
66+
```typ
67+
#definition[
68+
This is a definition.
69+
]
70+
```
71+
72+
```typ
73+
#question[
74+
This is a question.
75+
]
76+
```
77+
78+
```typ
79+
#task[
80+
This is a task.
81+
]
82+
```
83+
84+
```typ
85+
#brainstorming(lang: "zh")[
86+
This is a brainstorming.
87+
]
88+
```
89+
90+
```typ
91+
#definition(lang: "zh")[
92+
This is a definition.
93+
]
94+
```
95+
96+
```typ
97+
#question(lang: "zh")[
98+
This is a question.
99+
]
100+
```
101+
102+
```typ
103+
#task(lang: "zh")[
104+
This is a task.
105+
]
106+
```
107+
108+
## Edit in the vscode(Recommended)
109+
110+
1. Install the [Tinymist Typst](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) extension in VS Code, which provides syntax highlighting, error checking, and PDF preview
111+
112+
2. Start the project
113+
114+
```bash
115+
typst init @preview/xyznote:0.3.0
116+
```
117+
118+
```bash
119+
cd xyznote
120+
```
121+
122+
```bash
123+
code .
124+
```
125+
126+
3. Press `Ctrl+K V` to open the PDF preview
127+
128+
4. Click `Export PDF` at the top of the Typst file to export the PDF.
129+
130+
## Edit in the Webapp
131+
132+
Click the `Create project in app` button on the right to edit within the Webapp.
133+
134+
## Acknowledgments
135+
136+
The following projects have been instrumental in providing substantial inspiration and code for this project.
137+
138+
https://github.com/gRox167/typst-assignment-template
139+
140+
https://github.com/DVDTSB/dvdtyp
141+
142+
https://github.com/a-kkiri/SimpleNote
143+
144+
https://github.com/spidersouris/touying-unistra-pristine
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#import "colors.typ": *
2+
// 定义提示框类型的翻译
3+
#let ADMONITION-TRANSLATIONS = (
4+
"task": ("en": "Task", "zh": "任务"),
5+
"definition": ("en": "Definition", "zh": "定义"),
6+
"brainstorming": ("en": "Brainstorming", "zh": "头脑风暴"),
7+
"question": ("en": "Question", "zh": "问题"),
8+
)
9+
10+
// 通用提示框函数
11+
#let admonition(
12+
body,
13+
title: none,
14+
// time: none,
15+
primary-color: pink.E,
16+
secondary-color: pink.E.lighten(90%),
17+
tertiary-color: pink.E,
18+
dotted: false,
19+
figure-kind: none,
20+
text-color: black,
21+
emoji: none,
22+
..args,
23+
) = {
24+
let lang = args.named().at("lang", default: "en")
25+
set text(font: ("libertinus serif", "KaiTi")) // color-box 字体
26+
27+
// 获取标题文本
28+
let title = if title == none {
29+
(ADMONITION-TRANSLATIONS).at(figure-kind).at(lang)
30+
} else {
31+
title
32+
}
33+
34+
// 创建提示框内容
35+
block(
36+
width: 100%,
37+
height: auto,
38+
inset: 0.2em,
39+
outset: 0.2em,
40+
fill: secondary-color,
41+
stroke: (
42+
left: (
43+
thickness: 5pt,
44+
paint: primary-color,
45+
dash: if dotted { "dotted" } else { "solid" },
46+
),
47+
),
48+
pad(
49+
left: 0.3em,
50+
right: 0.3em,
51+
text(
52+
size: 1.1em,
53+
strong(
54+
text(
55+
fill: tertiary-color,
56+
emoji + " " + smallcaps(title),
57+
),
58+
),
59+
)
60+
+ block(
61+
above: 0.8em,
62+
text(size: 1.2em, fill: text-color, body),
63+
),
64+
),
65+
)
66+
}
67+
68+
// 特定类型的提示框函数
69+
#let task(body, ..args) = admonition(
70+
body,
71+
primary-color: blue.E,
72+
secondary-color: blue.E.lighten(90%),
73+
tertiary-color: blue.E,
74+
figure-kind: "task",
75+
emoji: emoji.hand.write,
76+
..args,
77+
)
78+
79+
#let definition(body, ..args) = admonition(
80+
body,
81+
primary-color: ngreen.C,
82+
secondary-color: ngreen.C.lighten(90%),
83+
tertiary-color: ngreen.B,
84+
figure-kind: "definition",
85+
emoji: emoji.brain,
86+
..args,
87+
)
88+
89+
#let brainstorming(body, ..args) = admonition(
90+
body,
91+
primary-color: orange.E,
92+
secondary-color: orange.E.lighten(90%),
93+
tertiary-color: orange.E,
94+
figure-kind: "brainstorming",
95+
emoji: emoji.lightbulb,
96+
..args,
97+
)
98+
99+
#let question(body, ..args) = admonition(
100+
body,
101+
primary-color: violet.E,
102+
secondary-color: violet.E.lighten(90%),
103+
tertiary-color: violet.E,
104+
figure-kind: "question",
105+
emoji: emoji.quest,
106+
..args,
107+
)
108+
109+
// Green mark box
110+
#let markbox(body) = {
111+
block(
112+
fill: rgb(250, 255, 250),
113+
width: 100%,
114+
inset: 8pt,
115+
radius: 4pt,
116+
stroke: rgb(31, 199, 31),
117+
body,
118+
)
119+
}
120+
121+
// Blue tip box
122+
#let tipbox(cite: none, body) = [
123+
#set text(size: 10.5pt)
124+
#pad(left: 0.5em)[
125+
#block(
126+
breakable: true,
127+
width: 100%,
128+
fill: rgb("#d0f2fe"),
129+
radius: (left: 1pt),
130+
stroke: (left: 4pt + rgb("#5da1ed")),
131+
inset: 1em,
132+
)[#body]
133+
]
134+
]

0 commit comments

Comments
 (0)