Skip to content

Commit 5c2b144

Browse files
committed
Add documentation for challenge description template fields
Signed-off-by: Robert Detjens <[email protected]>
1 parent af3aae0 commit 5c2b144

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/configparser/challenge.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,36 @@ pub fn parse_one(path: &PathBuf) -> Result<ChallengeConfig> {
122122
pub struct ChallengeConfig {
123123
name: String,
124124
author: String,
125+
126+
/// Challenge description, displayed to players on the frontend.
127+
/// Supports markdown and Jinja-style templating for challenge info via
128+
/// [minijinja](https://docs.rs/minijinja).
129+
///
130+
/// The Jinja template fields available are:
131+
///
132+
/// | Field name | Description |
133+
/// | ----------- | ----------- |
134+
/// | `hostname` | The hostname or domain for the challenge
135+
/// | `port` | The port that the challenge is listening on
136+
/// | `nc` | Insert the `nc` command to connect to TCP challenges (`nc {{hostname}} {{port}}`)
137+
/// | `link` | Create a Markdown link to the exposed hostname/port
138+
/// | `url` | The URL from `link` without the accompanying Markdown
139+
/// | `challenge` | The full challenge.yaml config for this challenge, with subfields
140+
///
141+
/// Example:
142+
///
143+
/// ```yaml
144+
/// description: |
145+
/// Some example challenge. Blah blah blah flavor text.
146+
///
147+
/// In case you missed it, this was written by {{ challenge.author }}
148+
/// and is called {{ challenge.name }}.
149+
///
150+
/// {{ link }} # -becomes-> [example.chals.thectf.com](https://example.chals.thectf.com)
151+
/// {{ nc }} # -becomes-> `nc example.chals.thectf.com 12345`
152+
/// ```
125153
description: String,
154+
126155
category: String,
127156

128157
directory: PathBuf,

0 commit comments

Comments
 (0)