基于 rewind-note 魔改的自用 Typst 小红书模板。
|
|
在你的项目目录中创建软链接,比如
ln -s <path/to/typst-rednote> ./typst-rednotegit submodule add <repository-url> ./typst-rednote#import "typst-rednote/lib.typ": *
// 使用主题
#show: theme.with(
font-family: serif-fonts,
bg-color: rgb("#fff0f0"),
accent-color: rgb("#ff6b6b"),
)
// 添加封面
#cover(
title: "你的标题",
subtitle: "副标题",
author: "@你的ID",
)
// 开始写作
= 标题
正文内容...#import "lib.typ": *font-family: 字体族(serif-fonts / sans-fonts / code-fonts)bg-color: 背景色text-color: 文字颜色highlight-color: 高亮颜色accent-color: 强调色page-width: 页面宽度(默认 1080pt)page-height: 页面高度(默认 1800pt)body-size: 正文字号(默认 42pt)
- Source Han Sans SC - 思源黑体(主要字体)
- Source Han Sans HW SC - 思源黑体等宽版(可选)
- PingFang SC - macOS 原生黑体(macOS 自带)
- Heiti SC - 基础黑体(macOS 自带)
- JetBrains Mono - 主要代码字体(下载地址:官网)
- Menlo
请从各自官网下载并安装字体,或使用系统包管理器安装。
注意:模板使用了字体回退机制,如果没有全部字体,会自动使用系统可用字体。
typst-rednote/
├── lib.typ # 统一导出入口
├── main.typ # 模板示例
├── core/
│ └── constants.typ # 字体、颜色等常量
└── themes/
├── theme.typ # 主题函数
└── cover.typ # 封面组件

