Programming lessons in Markdown

Lessons that compile.

Write the lesson in Markdown. Every code block gets a ▶ that compiles with the real g++ and shows the output in a terminal, right there, on the projector.

$ trunade lesson.md

Get started →

lesson-02.mdlocalhost:4747

Reading from the keyboard

cpp
#include <iostream>
#include <string>

int main() {
    std::string name;
    std::cout << "What's your name? ";
    std::cin >> name;
    std::cout << "Hello, " << name << "!\n";
}

Press ▶ and type your name in the terminal.

The lesson is a file.

Plain Markdown, in your editor. Save it and the page updates.

lesson-02.md
## Reading from the keyboard

Use `std::cin` to read from standard input.

```cpp
#include <iostream>
int main() {
    int a, b;
    std::cin >> a >> b;
    std::cout << a + b << "\n";
}
```

```stdin
2 40
```
Whole programs
Each block has its own main() and is compiled from scratch, like in an exam.
Real input
A stdin block shipped with the lesson, expected output with a judge verdict, or interactive cin in the terminal.
Errors are content
Full compiler errors, signals, time limits and exit codes.

What comes built in.

C++, C and Python
Other languages through configuration, with any compiler and flags.
Hidden template
Declare #include and using namespace std once; each block shows only what matters.
Test cases
stdin/expected pairs with ✓ or ✗ like a judge: passed the sample, failed the edge case.
Math and diagrams
LaTeX and Mermaid rendered locally.
Questions and steps
Quiz blocks and exercises with statement, hint and a solution that runs.
Made for the projector
T for the outline, space for the next section, Z zooms a block, F for full screen.
Run all
R runs every block with fixed input and points at what broke, before you walk into class.
PDF and HTML
Export the lesson with its outputs; the HTML opens anywhere and replays each run on ▶.
Research log
A local, anonymous log of runs, errors, answers and sections, to study the lesson.
Edit fearlessly
Change code during class; the file stays the same.
Offline
One local binary. No CDN, no account, no cloud.
Your fonts
Theme, width and title, text and code fonts, kept for every lesson.

What about Jupyter?

Great when state across cells is the point: data, plots, exploration. A C++ lesson asks for something else.

Trunade!Jupyter
Blocka whole program, with main()a cell that continues earlier state
Compilerthe real one, with your flagsthe kernel's (C++ interpreted)
Inputinteractive terminal or fixed stdinlimited
Expected outputa verdict per case, like a judgeby hand
Fileplain MarkdownJSON with embedded outputs

Install and run.

$ brew install gcc        # g++-16 on macOS
$ ./install.sh
$ trunade lesson.md

Installation guide →