/
Quarkdown 可以在编译时从宿主系统中读取环境变量,使文档能够根据其编译所在的环境来调整内容。
.env {name} 文档 ↗ 返回给定名称的环境变量的值,若未设置则返回 none。
This page was compiled with .env {SHELL} as the default shell.This page was compiled with
Cannot read environment variable 'SHELL': not enough privileges to perform this action.
Missing required permission: process.
To grant this permission, run with: --allow process
由于结果可能是 none,你可以使用可选项函数 来处理缺失的值:
.container background:{.env {COLOR}::otherwise {teal}}
Hello, world!Cannot read environment variable 'COLOR': not enough privileges to perform this action.
Missing required permission: process.
To grant this permission, run with: --allow process
读取环境变量需要 process 权限。
quarkdown c main.qd --allow process