/

Environment

Quarkdown can read environment variables from the host system at compile time, allowing documents to adapt their content based on the environment they are compiled in.

Reading an environment variable

.env {name} docs ↗ returns the value of the environment variable with the given name, or none if it is not set.

Example 1

This page was compiled with .env {SHELL} as the default shell.

This page was compiled with /bin/bash as the default shell.

Example 2

Since the result may be none, you can use optionality functions to handle missing values:

.container background:{.env {COLOR}::otherwise {teal}}
    Hello, world!

Hello, world!

Permissions

Reading environment variables requires the process permission.

quarkdown c main.qd --allow process