标准代码框
```ts
export function trimPathSuffix(fp: string): string {
fp = clientSideSlug(fp)
let [cleanPath, anchor] = fp.split("#", 2)
anchor = anchor === undefined ? "" : "#" + anchor
return cleanPath + anchor
}
```
export function trimPathSuffix(fp: string): string {
fp = clientSideSlug(fp)
let [cleanPath, anchor] = fp.split("#", 2)
anchor = anchor === undefined ? "" : "#" + anchor
return cleanPath + anchor
}参考
更多关于行高亮的详细说明,请参考 Quartz 官方文档 - Line Highlighting。
行高亮
```js {2-3,6}
```
export function trimPathSuffix(fp: string): string {
fp = clientSideSlug(fp)
let [cleanPath, anchor] = fp.split("#", 2)
anchor = anchor === undefined ? "" : "#" + anchor
return cleanPath + anchor
}单词高亮
```js /useState/
const [age, setAge] = useState(50);
const [name, setName] = useState('Taylor');
```
const [age, setAge] = useState(50);
const [name, setName] = useState('Taylor');行内高亮
This is an array `[1, 2, 3]{:js}` of numbers 1 through 3.
This is an array [1, 2, 3] of numbers 1 through 3.
特定行号
```js showLineNumbers{20}
```
export function trimPathSuffix(fp: string): string {
fp = clientSideSlug(fp)
let [cleanPath, anchor] = fp.split("#", 2)
anchor = anchor === undefined ? "" : "#" + anchor
return cleanPath + anchor
}转义代码块
通过使用比前一个围栏多一个反引号的另一层反引号围栏来在代码块内部设置代码块格式。
````
```js /useState/
const [age, setAge] = useState(50);
const [name, setName] = useState('Taylor');
```
````
```js /useState/
const [age, setAge] = useState(50);
const [name, setName] = useState('Taylor');
```
折叠代码块
为了提升长代码的可读性,我们引入了代码块折叠功能。你可以通过在代码块语言标识后添加 fold 关键字来实现。
使用方法
```ts fold title="可折叠的代码块"
// 这里的代码默认会被折叠
console.log("Hello, Quartz!");
```可折叠的代码块
// 这里的代码默认会被折叠
console.log("Hello, Quartz!");