-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ana Gelez <[email protected]>
- Loading branch information
Showing
9 changed files
with
1,552 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# Typst note template | ||
|
||
Simple and Functional Typst Note Template | ||
|
||
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. | ||
|
||
## Usage | ||
|
||
```typ | ||
#import "@preview/xyznote:0.3.0": * | ||
#show: xyznote.with( | ||
title: "xyznote", | ||
author: "wardenxyz", | ||
abstract: "A simple typst note template", | ||
createtime: "2024-11-27", | ||
lang: "zh", | ||
bibliography-style: "ieee", | ||
preface: [], //Annotate this line to delete the preface page. | ||
bibliography-file: bibliography("refs.bib"), //Annotate this line to delete the bibliography page. | ||
) | ||
``` | ||
|
||
## Features | ||
|
||
- **PDF Metadata**: Includes fields for title, author and date. | ||
|
||
- **Table of Contents**: Automatically generated ToC for easy navigation through the document. | ||
|
||
- **References (Optional)**: A dedicated section for citing sources and references. Include this only if you need it. | ||
|
||
## Custom styles | ||
|
||
```typ | ||
#tipbox[ | ||
contents | ||
] | ||
``` | ||
|
||
```typ | ||
#markbox[ | ||
contents | ||
] | ||
``` | ||
|
||
```typ | ||
#sectionline | ||
``` | ||
|
||
```typ | ||
This is #highlight(fill: blue.C)[highlighted in blue]. | ||
This is #highlight(fill: yellow.C)[highlighted in yellow]. | ||
This is #highlight(fill: green.C)[highlighted in green]. | ||
This is #highlight(fill: red.C)[highlighted in red]. | ||
``` | ||
|
||
```typ | ||
#brainstorming[ | ||
This is a brainstorming. | ||
] | ||
``` | ||
|
||
```typ | ||
#definition[ | ||
This is a definition. | ||
] | ||
``` | ||
|
||
```typ | ||
#question[ | ||
This is a question. | ||
] | ||
``` | ||
|
||
```typ | ||
#task[ | ||
This is a task. | ||
] | ||
``` | ||
|
||
```typ | ||
#brainstorming(lang: "zh")[ | ||
This is a brainstorming. | ||
] | ||
``` | ||
|
||
```typ | ||
#definition(lang: "zh")[ | ||
This is a definition. | ||
] | ||
``` | ||
|
||
```typ | ||
#question(lang: "zh")[ | ||
This is a question. | ||
] | ||
``` | ||
|
||
```typ | ||
#task(lang: "zh")[ | ||
This is a task. | ||
] | ||
``` | ||
|
||
## Edit in the vscode(Recommended) | ||
|
||
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 | ||
|
||
2. Start the project | ||
|
||
```bash | ||
typst init @preview/xyznote:0.3.0 | ||
``` | ||
|
||
```bash | ||
cd xyznote | ||
``` | ||
|
||
```bash | ||
code . | ||
``` | ||
|
||
3. Press `Ctrl+K V` to open the PDF preview | ||
|
||
4. Click `Export PDF` at the top of the Typst file to export the PDF. | ||
|
||
## Edit in the Webapp | ||
|
||
Click the `Create project in app` button on the right to edit within the Webapp. | ||
|
||
## Acknowledgments | ||
|
||
The following projects have been instrumental in providing substantial inspiration and code for this project. | ||
|
||
https://github.com/gRox167/typst-assignment-template | ||
|
||
https://github.com/DVDTSB/dvdtyp | ||
|
||
https://github.com/a-kkiri/SimpleNote | ||
|
||
https://github.com/spidersouris/touying-unistra-pristine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
#import "colors.typ": * | ||
// 定义提示框类型的翻译 | ||
#let ADMONITION-TRANSLATIONS = ( | ||
"task": ("en": "Task", "zh": "任务"), | ||
"definition": ("en": "Definition", "zh": "定义"), | ||
"brainstorming": ("en": "Brainstorming", "zh": "头脑风暴"), | ||
"question": ("en": "Question", "zh": "问题"), | ||
) | ||
|
||
// 通用提示框函数 | ||
#let admonition( | ||
body, | ||
title: none, | ||
// time: none, | ||
primary-color: pink.E, | ||
secondary-color: pink.E.lighten(90%), | ||
tertiary-color: pink.E, | ||
dotted: false, | ||
figure-kind: none, | ||
text-color: black, | ||
emoji: none, | ||
..args, | ||
) = { | ||
let lang = args.named().at("lang", default: "en") | ||
set text(font: ("libertinus serif", "KaiTi")) // color-box 字体 | ||
|
||
// 获取标题文本 | ||
let title = if title == none { | ||
(ADMONITION-TRANSLATIONS).at(figure-kind).at(lang) | ||
} else { | ||
title | ||
} | ||
|
||
// 创建提示框内容 | ||
block( | ||
width: 100%, | ||
height: auto, | ||
inset: 0.2em, | ||
outset: 0.2em, | ||
fill: secondary-color, | ||
stroke: ( | ||
left: ( | ||
thickness: 5pt, | ||
paint: primary-color, | ||
dash: if dotted { "dotted" } else { "solid" }, | ||
), | ||
), | ||
pad( | ||
left: 0.3em, | ||
right: 0.3em, | ||
text( | ||
size: 1.1em, | ||
strong( | ||
text( | ||
fill: tertiary-color, | ||
emoji + " " + smallcaps(title), | ||
), | ||
), | ||
) | ||
+ block( | ||
above: 0.8em, | ||
text(size: 1.2em, fill: text-color, body), | ||
), | ||
), | ||
) | ||
} | ||
|
||
// 特定类型的提示框函数 | ||
#let task(body, ..args) = admonition( | ||
body, | ||
primary-color: blue.E, | ||
secondary-color: blue.E.lighten(90%), | ||
tertiary-color: blue.E, | ||
figure-kind: "task", | ||
emoji: emoji.hand.write, | ||
..args, | ||
) | ||
|
||
#let definition(body, ..args) = admonition( | ||
body, | ||
primary-color: ngreen.C, | ||
secondary-color: ngreen.C.lighten(90%), | ||
tertiary-color: ngreen.B, | ||
figure-kind: "definition", | ||
emoji: emoji.brain, | ||
..args, | ||
) | ||
|
||
#let brainstorming(body, ..args) = admonition( | ||
body, | ||
primary-color: orange.E, | ||
secondary-color: orange.E.lighten(90%), | ||
tertiary-color: orange.E, | ||
figure-kind: "brainstorming", | ||
emoji: emoji.lightbulb, | ||
..args, | ||
) | ||
|
||
#let question(body, ..args) = admonition( | ||
body, | ||
primary-color: violet.E, | ||
secondary-color: violet.E.lighten(90%), | ||
tertiary-color: violet.E, | ||
figure-kind: "question", | ||
emoji: emoji.quest, | ||
..args, | ||
) | ||
|
||
// Green mark box | ||
#let markbox(body) = { | ||
block( | ||
fill: rgb(250, 255, 250), | ||
width: 100%, | ||
inset: 8pt, | ||
radius: 4pt, | ||
stroke: rgb(31, 199, 31), | ||
body, | ||
) | ||
} | ||
|
||
// Blue tip box | ||
#let tipbox(cite: none, body) = [ | ||
#set text(size: 10.5pt) | ||
#pad(left: 0.5em)[ | ||
#block( | ||
breakable: true, | ||
width: 100%, | ||
fill: rgb("#d0f2fe"), | ||
radius: (left: 1pt), | ||
stroke: (left: 4pt + rgb("#5da1ed")), | ||
inset: 1em, | ||
)[#body] | ||
] | ||
] |
Oops, something went wrong.