Explicode is an open-source project that lets you write rich Markdown documentation directly inside your code comments, turning a single source file into both runnable code and beautifully rendered documentation.
The VS Code extension provides live previews of your documentation directly inside the IDE. The npm package can convert supported source files into .md Markdown via the terminal or generate a GitHub Pagesβready docs/ folder. Because the documentation lives inside comments, it doesnβt affect your program or build process, no special compilers, configuration, or tooling changes are required. Simply write Markdown in your comments as you code. Keeping documentation in the same file as the code ensures it stays accurate and up to date, evolving alongside the implementation and automatically versioned with your project in Git. Explicode brings the principles of literate programming to modern development across many languages, without the need for language-specific frameworks or tedious setup.
Use Markdown syntax inside the multiline comments of your favorite language:
In Python, Explicode looks for triple-quoted strings (""" or ''') that start at the beginning of a line (only whitespace before them). These are the same positions Python uses for docstrings, at the top of a module, class, or function. Triple-quotes used as regular string values mid-expression are ignored.
"""
This is a Markdown doc block β triple-quote is at the start of the line.
"""
x = """this is NOT a doc block β it's a string value assigned to a variable"""
For all other supported languages, Explicode renders any /* ... */ block comment as Markdown. JSDoc-style /** ... */ comments are also supported.
/*
This is a Markdown doc block.
*/
/** This too β leading asterisks are stripped automatically. */
// Single-line comments are NOT rendered as Markdown, they stay as code.
Everything outside a doc block is rendered as a syntax-highlighted code block. Full CommonMark syntax is supported, including headings, lists, math with LaTeX syntax, images, tables, and more.
"""
# Fibonacci Sequence
Generates the first `n` Fibonacci numbers iteratively.
- **Input**: `n` (int) β how many numbers to generate
- **Output**: list of the first `n` Fibonacci numbers
"""
def fibonacci(n):
if n <= 0:
return []
elif n == 1:
return [0]
seq = [0, 1]
for _ in range(2, n):
seq.append(seq[-1] + seq[-2])
return seq
fibonacci(5) # [0, 1, 1, 2, 3]
# Fibonacci Sequence
Generates the first `n` Fibonacci numbers iteratively.
- **Input**: `n` (int) β how many numbers to generate
- **Output**: list of the first `n` Fibonacci numbers
```python
def fibonacci(n):
if n <= 0:
return []
elif n == 1:
return [0]
seq = [0, 1]
for _ in range(2, n):
seq.append(seq[-1] + seq[-2])
return seq
fibonacci(5) # [0, 1, 1, 2, 3]
```
/*
# Fibonacci Sequence
Generates the first `n` Fibonacci numbers iteratively.
- **Input**: `n` (int) β how many numbers to generate
- **Output**: list of the first `n` Fibonacci numbers
*/
function fibonacci(n) {
if (n <= 0) return [];
if (n === 1) return [0];
const seq = [0, 1];
for (let i = 2; i < n; i++) {
seq.push(seq[i - 1] + seq[i - 2]);
}
return seq;
}
fibonacci(5); // [0, 1, 1, 2, 3]
# Fibonacci Sequence
Generates the first `n` Fibonacci numbers iteratively.
- **Input**: `n` (int) β how many numbers to generate
- **Output**: list of the first `n` Fibonacci numbers
```javascript
function fibonacci(n) {
if (n <= 0) return [];
if (n === 1) return [0];
const seq = [0, 1];
for (let i = 2; i < n; i++) {
seq.push(seq[i - 1] + seq[i - 2]);
}
return seq;
}
fibonacci(5); // [0, 1, 1, 2, 3]
```
Explicode currently supports:
Need support for another language? Open an issue or reach out.
Explicode keeps your documentation and code in the same place. By writing Markdown directly inside code comments, you can turn a single source file into both runnable code and clear, readable documentation. This makes documentation easier to maintain, keeps it versioned alongside your code, and helps others understand your work without needing separate documentation files or tools.
No. Explicode works directly with your existing source files. Simply write Markdown inside your code comments and open the preview. Thereβs no need for special file formats, configuration, or changes to your build system.
No. Explicode only reads your source file β it never modifies it. Documentation lives inside standard language comments, so your compiler, interpreter, and build tools see exactly the same code they always did.
No. Explicode only reads your source file locally to generate the rendered preview. Your code is never uploaded or stored in any database.
Tools like JSDoc and Sphinx extract documentation from special comment annotations (for example @param or @returns) and generate API reference docs. Explicode takes a different approach: your comments are free-form Markdown prose, letting you write narrative documentation, tutorials, or literate-programming-style explanations β not just API stubs. It also works across many languages without any language-specific toolchain.
Absolutely. Open an issue on GitHub with the language name and its block comment syntax. Languages that use /* ... */ style block comments are usually trivial to add.
Yes! The extension is free to install from the VS Code Marketplace. Check the repository for license details and source code.
Have a bug report, feature request, or collaboration idea?
Reach out at froem076@umn.edu.
Explicode Β· 2026