Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Markdown AlgorithmsNew to Visual Studio Code? Get it now.
Markdown Algorithms

Markdown Algorithms

Luca Previati

|
2 installs
| (0) | Free
Render pseudocode algorithm blocks in VS Code Markdown preview.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Markdown Algorithms

Render pseudocode fences in the VS Code Markdown preview with an algorithm-style layout.

Usage

Use a fenced code block with one of these languages:

  • algorithm
  • algo
  • alg
  • pseudocode
  • pseudo
```algorithm title="Euclid" label="alg:euclid" input="integers \(a, b\)" output="\(\text{gcd}(a,b)\)" linenos latex
while b != 0 do
  r <- a mod b
  a <- b
  b <- r
return a
```

Supported fence options:

  • title="..." or caption="...": caption shown above the algorithm.
  • label="...": optional label shown in the caption and included in generated LaTeX.
  • input="...", output="...", require="...", or ensure="...": algorithm parameters shown before the body. Inline LaTeX syntax such as \(\text{gcd}(a,b)\) is rendered in the preview.
  • linenos or numbers: show line numbers.
  • latex: render only the algorithm2e-style view. Omit it to render only the code-block-style pseudocode view.
  • bsyntax: use brace syntax for control blocks, such as while (condition) { ... }.

Use the command Markdown Algorithms: Copy Algorithm LaTeX from the Command Palette while your cursor is inside an algorithm fence, or while one or more algorithm fences are selected, to copy algorithm2e LaTeX.

Each rendered algorithm preview also includes a Copy LaTeX action in its caption. If a fence has a label, the preview exposes it as a clickable anchor, so links such as [Euclid](#markdown-algorithm-alg-euclid) can jump to label="alg:euclid".

Settings

  • markdownAlgorithms.defaultTitle: default caption when a fence does not set title or caption.
  • markdownAlgorithms.defaultLineNumbers: show line numbers unless a fence sets linenos=false or numbers=false.
  • markdownAlgorithms.defaultLatex: use the LaTeX-style preview unless a fence sets latex=false.
  • markdownAlgorithms.defaultBraceSyntax: parse brace syntax unless a fence sets bsyntax=false.

Inside algorithm steps, common pseudocode operators are rendered as math symbols:

  • <- renders as ← and exports as \leftarrow{}.
  • -> renders as → and exports as \rightarrow{}.
  • <=, >=, and != render as ≤, ≥, and ≠.

The preview also highlights common pseudocode keywords, function calls, numbers, quoted strings, and inline comments.

Brace syntax example:

```algorithm title="Euclid" input="integers \(a, b\)" output="\(\text{gcd}(a,b)\)" linenos bsyntax
while (b != 0) {
  r <- a mod b;
  a <- b;
  b <- r;
}
return a;
```

Brace syntax also supports function, procedure, and repeat / until blocks:

```algorithm title="Repeat Example" bsyntax
function gcd(a, b) {
  repeat {
    a <- b;
  } until (a == b);
}
```
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft