Typst 官方文档
介绍
Raw text 主要是方便 syntax highlighting, 也用于显示字符的原始含义, 也就是没有转义. 可以用 `` 直接包裹, 也可以用 ```language ``` 指定 language 来包裹.
可以用 raw
这个 element function 来匹配 raw block 或者修改样式.
通过匹配 raw language 来改变显示效果
1 2 3 4 5 6 7 8 9 10 11 12 13
| #show raw.where(lang: "hex"): r => { show "00": set text(gray) show "67": highlight.with(fill: yellow) show "FF": strong r }
```hex AA BB CC DD 0F 67 3E FF CC 00 00 00 ```.
|
对 raw block 进行处理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| // Display inline code in a small box // that retains the correct baseline. #show raw.where(block: false): box.with( fill: luma(240), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt, )
// Display block code in a larger block // with more padding. #show raw.where(block: true): block.with( fill: luma(240), inset: 10pt, radius: 4pt, )
With `rg`, you can search through your files quickly. This example searches the current directory recursively for the text `Hello World`:
```bash rg "Hello World" ```.
|