Prompt templates

Ready-to-use prompts for common Rho generation scenarios. Copy → replace {{...}} placeholders → feed to your LLM.


Template 1: Universal generator

Use: baseline for any Rho document generation.

System prompt

You are a Rho format generator. Rho is markdown extended with these blocks:

# Callout
> [!INFO] | [!WARN] | [!ZEN]
> body content

# Layout grid
\```layout grid cols=N        (N: 1-6)
:::card accent=blue|red|green|yellow|purple|gray
content
:::
\```

# Tabs / Stepper / Modal / Timeline / Annotate
(see protocol)

# Interactive (most important)
\```interact
slider name min max initial step
input name "default"
select name "opt1" "opt2"
toggle name true
button name "label" value
computed varName = expression
timer t min max step loop|once|pingpong|pause
template stl:
  [label] -> [{varName}]
  [label2] -> [{(expr):.2f}]
template vega-lite:
  { ... vega-lite spec with {var} placeholders ... }
template svg:
  <svg viewBox="0 0 100 100">...{expr}...</svg>
\```

# Mini DSL (in {} placeholders)
+, -, *, /, %, **
==, !=, <, >, <=, >=, &&, ||, !, ?:
pow(a,b), sqrt(x), sin(x), cos(x), tan(x), pi, e
abs, min, max, floor, ceil, round
NOT JavaScript - no Math.X, no if/else, no functions

# Format spec
{value:.2f}  - 2 decimals
{value:.0f}  - integer
{value:%}    - percentage (auto ×100)

# Cross-block state sharing
\```interact namespace foo
slider rate ...
\```

\```interact namespace foo
template stl: [{rate}]    ← reuses rate
\```

# Plain-text fallback
All Rho DSL must be valid markdown so non-Rho readers see source as plain text.

Task: based on user request, generate clean Rho format markdown.
Be concise. Don't add unrelated content.

User prompt template

Generate a Rho format document for: {{topic}}

Requirements:
- {{requirement 1}}
- {{requirement 2}}

Make it interactive where it adds value.

Template 2: Calculator

Use: BMI / compound interest / mortgage / any "input parameters → display result" tool.

Prompt

Generate a Rho calculator for: {{topic}}

Inputs (sliders):
- {{var1}}: range {{min1}} to {{max1}}, default {{default1}}, step {{step1}}
- {{var2}}: range {{min2}} to {{max2}}, default {{default2}}, step {{step2}}

Formula: {{formula expression}}

Output:
- Display the formula
- Show all input values + computed result
- Format result to {{N}} decimal places

Example: BMI calculator

User input:

Generate a Rho calculator for: BMI (Body Mass Index)

Inputs (sliders):
- weight: range 40 to 120, default 70, step 1
- height: range 1.4 to 2.1, default 1.7, step 0.01

Formula: BMI = weight / (height * height)

Output:
- Display the formula
- Show weight, height, BMI
- Format BMI to 1 decimal place
- Add a category label (underweight/normal/overweight/obese)

LLM output should look like:

# BMI Calculator

> [!INFO]
> **Formula**: BMI = weight (kg) / height² (m)

```interact
slider weight 40 120 70 1
slider height 1.4 2.1 1.7 0.01
computed bmi = weight / (height * height)
computed category = bmi < 18.5 ? "Underweight" : bmi < 24 ? "Normal" : bmi < 28 ? "Overweight" : "Obese"
template stl:
[Weight] -> [{weight} kg]
[Height] -> [{height:.2f} m]
[BMI] -> [{bmi:.1f}] ::mod(category="{category}")
```

Template 3: Data viz + chart

Use: parameter-driven math functions / probability distributions / physics curves.

Prompt

Generate a Rho document with a Vega-Lite chart for: {{topic}}

Parameters (sliders):
- {{param1}}: {{min1}} to {{max1}}, default {{default1}}
- {{param2}}: {{min2}} to {{max2}}, default {{default2}}

Plot: {{function description, e.g., "sin({param1} * x) over x in [0, 6.28]"}}

X axis: {{x label}}, range [{{xmin}}, {{xmax}}]
Y axis: {{y label}}, range [{{ymin}}, {{ymax}}]

Example: Sine wave with frequency / amplitude

User input:

Generate a Rho document with a Vega-Lite chart for: Sine wave

Parameters (sliders):
- frequency: 0.5 to 5, default 1
- amplitude: 0.1 to 2, default 1

Plot: amplitude * sin(frequency * x) over x in [0, 6.28]

X axis: time, range [0, 6.28]
Y axis: amplitude, range [-2, 2]

LLM should output:

# Sine Wave Explorer

```interact
slider frequency 0.5 5 1 0.1
slider amplitude 0.1 2 1 0.1
template vega-lite:
{
  "width": 500,
  "height": 200,
  "data": {"sequence": {"start": 0, "stop": 6.28, "step": 0.05, "as": "x"}},
  "transform": [
    {"calculate": "{amplitude} * sin({frequency} * datum.x)", "as": "y"}
  ],
  "mark": "line",
  "encoding": {
    "x": {"field": "x", "type": "quantitative", "title": "time"},
    "y": {"field": "y", "type": "quantitative", "title": "amplitude", "scale": {"domain": [-2, 2]}}
  }
}
```

Template 4: Step-by-step tutorial

Use: install steps / teaching walkthrough / configuration wizard.

Prompt

Generate a Rho stepper tutorial for: {{topic}}

Steps:
1. {{step 1 title}} - {{step 1 detail}}
2. {{step 2 title}} - {{step 2 detail}}
3. {{step 3 title}} - {{step 3 detail}}
...

Each step should have:
- Clear action
- Code block if applicable
- Brief explanation (< 50 words)

Example: install Rho

User input:

Generate a Rho stepper tutorial for: installing Rho desktop app

Steps:
1. Download - Get the binary for your platform from GitHub
2. Install - Standard install for macOS/Windows/Linux
3. First open - Launch and pick a .md file
4. Verify - Should see colored callouts and interactive sliders

LLM output:

# Install Rho Desktop App

```stepper
:::step title="Download"
Get the binary for your platform:

\```bash
# macOS
brew install rho

# Linux
curl -L https://github.com/scos-lab/markview/releases/latest/rho.AppImage -o rho.AppImage
chmod +x rho.AppImage
\```
:::

:::step title="Install"
Drag the `.dmg` to Applications (macOS), run the `.msi` (Windows), or place `.AppImage` somewhere on PATH (Linux).
:::

:::step title="First open"
Launch Rho. File → Open → select any `.md` file.
:::

:::step title="Verify"
The file should render with colored callouts and any interactive blocks should be working (sliders draggable).
:::
```

Template 5: Comparison layout

Use: plan A vs B vs C / pricing tiers / horizontal tool comparison.

Prompt

Generate a Rho layout grid comparing: {{N}} options/plans/tools

Options:
- {{name 1}}: {{key features}}
- {{name 2}}: {{key features}}
- {{name 3}}: {{key features}}

For each, include:
- Title (bold)
- Bulleted feature list (3-5 items)
- {{additional info, e.g., "price"}}

Example: 3-tier pricing

User input:

Generate a Rho layout grid comparing: 3 SaaS pricing tiers

Options:
- Free: 5 docs, community support, $0/mo
- Pro: unlimited docs, email support, private sharing, $10/mo
- Team: SSO, audit log, priority support, SLA, $50/mo

For each:
- Bold title
- Bulleted feature list
- Price at the bottom

LLM output:

# Pricing

```layout grid cols=3
:::card accent=gray
**Free**

- 5 documents
- Community support
- Public sharing only

$0/month
:::

:::card accent=blue
**Pro**

- Unlimited documents
- Email support
- Private sharing

$10/month
:::

:::card accent=purple
**Team**

- SSO + audit log
- Priority support
- 99.9% SLA

$50/month
:::
```

Template 6: Animation demo (SVG + timer)

Use: physics simulation / algorithm visualization / rotation / vibration.

Prompt

Generate a Rho SVG animation for: {{topic}}

Use a timer to drive: {{what changes over time}}
Use sliders for adjustable parameters: {{params}}

The animation:
- viewBox: {{viewbox dims}}
- Elements: {{describe shapes}}
- Position formula: {{describe how positions are computed from timer + params}}

Example: Pendulum

User input:

Generate a Rho SVG animation for: simple pendulum

Use a timer to drive: angle of swing
Use a slider: pendulum length (30 to 80, default 50)

The animation:
- viewBox 0 0 200 100
- Pivot at (100, 0), pendulum bob below
- Position: bob swings horizontally based on length * sin(2 * pi * t / 2)
- Bob: red circle radius 6

LLM output:

# Simple Pendulum

```interact
timer t 0 10 0.05 loop
slider length 30 80 50 1
template svg:
<svg viewBox="0 0 200 100" width="400" height="200">
  <circle cx="100" cy="0" r="2" fill="#888"/>
  <line x1="100" y1="0"
        x2="{100 + length * sin(2*pi*t/2):.2f}"
        y2="{length * cos(2*pi*t/2):.2f}"
        stroke="#888" stroke-width="1"/>
  <circle cx="{100 + length * sin(2*pi*t/2):.2f}"
          cy="{length * cos(2*pi*t/2):.2f}"
          r="6" fill="red"/>
</svg>
```

Template 7: Composite document (multiple capabilities)

Use: full teaching doc / product doc / data exploration report.

Prompt

Generate a Rho document about: {{topic}}

Structure:
1. H1 title
2. Brief intro paragraph
3. A callout highlighting the key insight
4. An interactive section with {{controls}} that drives:
   - Numerical output (template stl)
   - A chart (template vega-lite)
5. A comparison layout showing {{N options}}
6. A summary callout

Use namespace to share state between the interactive blocks.

LLM should output a complete multi-block document (callout / interact / chart / layout / namespace sharing).


General prompt tips

1. Strong hint about mini DSL

LLMs default to JS syntax. Be explicit:

IMPORTANT: Use Rho mini DSL — NOT JavaScript.
Available functions: pow, sqrt, sin, cos, tan, abs, min, max, floor, ceil, log, exp.
Constants: pi, e.
NO Math.sin, NO Math.PI, NO if/else statements (use ternary ?:).

2. Explicit namespace instruction

When multiple interact blocks should share variables, use:
\```interact namespace finance
slider rate ...
\```

\```interact namespace finance
template stl: [{rate}]
\```

3. Plain-text fallback hint

All output must be valid markdown — Rho DSL goes inside fenced code blocks (```) or directive containers (:::). Don't write raw HTML / JSX outside these blocks.

4. Chart range constraint

For Vega-Lite charts, keep data points < 5000 (use sequence step appropriately).
Numeric placeholders {var} go without quotes; string placeholders "{var}" with quotes.

5. SVG safety hint

For SVG templates, never use <script>, <foreignObject>, on* event attributes, or javascript: URLs. They will be stripped by the safety sanitizer.

See also