Live code
Explain a function in a note and the note tells you when the function changes — with what changed, and one click to bring the note up to date.
- / → Live code from a repository.
- Give the file, and a function or class name — or a range of lines. Leave the repository empty for this notebook’s, or name any
owner/name. - Embed. The code is fetched and a copy kept in the note.
Each time the note is opened, the current code is fetched and compared with the copy:
- Matches the repository, with the lines it is on and Open on GitHub.
- The code has changed since this note was written, with Show what changed (a line diff) and Update the note.
- A plain sentence when the function or the file is gone — the copy stays.
What the note holds
```live-code
repo: acme/api
path: src/lib/auth.ts
symbol: login
---
export async function login(user, password) {
…
}
```The copy is what makes it portable: on github.com or in Obsidian the block is still the code it explains. Functions are found by how each language declares them — TypeScript and JavaScript (including arrow functions and methods), Python, Go, Rust, Java, Kotlin, Swift, the C family and Ruby — with the comment above them.