---
title: "Markdown wikilinks: pipe order in pandoc tests"
slug: markdown-wikilinks
excerpt: "Markdown wikilinks under two pandoc extensions: see The wikilinks_title_before_pipe runs for HTML from the swapped pipe order."
quickAnswer: "Under What wiki.md holds, the input file for the lead runs is printed. HTML from both readers with no extension added is quoted in Plain readers kept the double brackets. Output with the text placed after the pipe sits in The wikilinks_title_after_pipe runs. The reversed order is quoted in The wikilinks_title_before_pipe runs. Two runs that name both extensions appear in Turning on both pipe orders together. Inputs with spaces, a hash part, bold text and a code span are covered in A space, a hash part and nearby emphasis. The wikilinks entries from each reader's extension list are shown in What the extension lists say. Repeatable numbered commands sit in Steps for checking wikilinks in a file."
keyTakeaways:
  - "Start with What wiki.md holds, which prints the two-paragraph input."
  - "Both plain readers' HTML for that input appears in Plain readers kept the double brackets."
  - "Look in The wikilinks_title_after_pipe runs for what pandoc gave with that extension added."
  - "Pandoc's output with both extensions named, in two orders, is under Turning on both pipe orders together."
  - "Numbered commands in Steps for checking wikilinks in a file repeat the checks."
publishedDate: 2026-10-21
dateModified: 2026-10-21
author: Bobby Huang
cluster: B
role: post
status: published
faq:
  - q: "Does pandoc read markdown wikilinks by default?"
    a: "The wikilinks entries in both extension lists are quoted under What the extension lists say."
  - q: "Which side of the pipe holds the link text?"
    a: "One pipe order's HTML is quoted in The wikilinks_title_after_pipe runs. The other order's HTML sits in The wikilinks_title_before_pipe runs."
  - q: "What happens if both wikilinks extensions are on?"
    a: "Two runs that name both are quoted in Turning on both pipe orders together."
  - q: "Can a wikilink target hold spaces or a # part?"
    a: "Such targets went through pandoc in A space, a hash part and nearby emphasis."
related:
  - markdown-links-to-local-files
  - markdown-reference-links
  - markdown-relative-paths-multiple-files
---

Markdown wikilinks are double-bracket links such as `[[plan]]`. Pandoc turns them into links only through two extensions, `wikilinks_title_after_pipe` and `wikilinks_title_before_pipe`. The two settings split a piped link like `[[jane-doe-notes|Jane Doe]]` in opposite ways, and this post shows how far apart the results land.

Every quoted result came off one Mac whose pandoc said it was 3.8.3. Two readers took the input: `markdown` and `commonmark`. This post's own script reran those commands and tried some new inputs. Relative links between files are out of scope; for those, read [links to local files](markdown-links-to-local-files.md).

## What wiki.md holds

The input is `wiki.md`, two short paragraphs of plain ASCII. Here is `cat wiki.md`:

```text
See [[plan]] for the steps.

Ask [[jane-doe-notes|Jane Doe]] before you merge.
```

Both paragraphs are kept short so that any change in the HTML stands out. The first link holds one word and nothing else. The second has a pipe with `jane-doe-notes` to its left and `Jane Doe` to its right. One half has to become the address and the other the displayed words, and pandoc's two extensions choose different halves.

## Plain readers kept the double brackets

First the file went through each reader with no extension added:

```sh
pandoc -f markdown -t html wiki.md
pandoc -f commonmark -t html wiki.md
```

The two runs printed identical HTML:

```html
<p>See [[plan]] for the steps.</p>
<p>Ask [[jane-doe-notes|Jane Doe]] before you merge.</p>
```

Neither reader made an `<a>` tag. Brackets, pipe and both names survived as ordinary characters, and both commands exited with code 0.

A short bracket form does exist in the CommonMark spec. There, a shortcut reference link needs its label to match a reference definition found elsewhere in the same document (spec lines 7655-7658 of version 0.31.2). Since `wiki.md` defines no references, the inner `[plan]` had nothing to match.

## The wikilinks_title_after_pipe runs

Both readers list this extension with a minus sign, so it has to be switched on by name. Adding a plus sign and the name to the reader turns it on for one run:

```sh
pandoc -f markdown+wikilinks_title_after_pipe -t html wiki.md
pandoc -f commonmark+wikilinks_title_after_pipe -t html wiki.md
```

Each command wrote these three lines:

```html
<p>See <a href="plan" class="wikilink">plan</a> for the steps.</p>
<p>Ask <a href="jane-doe-notes" class="wikilink">Jane Doe</a> before you
merge.</p>
```

The left half, `jane-doe-notes`, went into the `href`. The right half, `Jane Doe`, became the visible text. With no pipe at all, `[[plan]]` used the one word for both jobs. Every tag also gained `class="wikilink"`, a marker missing from the plain runs. The HTML wraps before `merge.` even though the source sentence sits on one line.

## The wikilinks_title_before_pipe runs

The second extension takes the same input. Only the name after the plus sign changed:

```sh
pandoc -f markdown+wikilinks_title_before_pipe -t html wiki.md
pandoc -f commonmark+wikilinks_title_before_pipe -t html wiki.md
```

Both readers returned this:

```html
<p>See <a href="plan" class="wikilink">plan</a> for the steps.</p>
<p>Ask <a href="Jane Doe" class="wikilink">jane-doe-notes</a> before you
merge.</p>
```

Nothing in the input says which order its author had in mind. The pipe is the same character under both settings. Here the halves traded places. `Jane Doe` became the `href`, with its space kept, and `jane-doe-notes` turned into the text. The first paragraph matched the after-pipe output exactly, since a link with one word has nothing to swap.

So a file typed for one order and read with the other gave a different address on the piped link in this test. The bare link came through fine, so the swap showed up in one link out of two.

## Turning on both pipe orders together

The extra script named both extensions in one reader string, then again in reverse:

```sh
pandoc -f markdown+wikilinks_title_after_pipe+wikilinks_title_before_pipe -t html wiki.md
pandoc -f markdown+wikilinks_title_before_pipe+wikilinks_title_after_pipe -t html wiki.md
```

Pandoc took both strings without an error and exited with code 0 each time. The two runs gave the same HTML:

```html
<p>See <a href="plan" class="wikilink">plan</a> for the steps.</p>
<p>Ask <a href="jane-doe-notes" class="wikilink">Jane Doe</a> before you
merge.</p>
```

That's the after-pipe result, line for line. Whichever name came first, the after-pipe reading won in this test. Naming one extension per run keeps the outcome plain to see.

## A space, a hash part and nearby emphasis

The extra script brought in `wiki-target.md`, whose targets hold spaces and a `#` part. Here is `cat wiki-target.md`:

```text
Read [[project plan#Steps|the steps]] first.

Then open [[Doe Holdings notes]].
```

It ran with the after-pipe extension:

```sh
pandoc -f markdown+wikilinks_title_after_pipe -t html wiki-target.md
```

```html
<p>Read <a href="project plan#Steps" class="wikilink">the steps</a>
first.</p>
<p>Then open <a href="Doe Holdings notes" class="wikilink">Doe Holdings
notes</a>.</p>
```

The `href` kept `project plan#Steps` exactly as typed. Pandoc added no percent codes and did not split off the part after the hash. The three-word target also kept its spaces, and the wrap fell inside the link text.

A second new file, `wiki-mixed.md`, puts the links among other inline Markdown and adds a code span:

```text
**Before** you merge, read [[plan]] and *then* ask [[jane-doe-notes|Jane Doe]].

Typed as code, `[[plan]]` stays as text.
```

It went through both readers with the after-pipe extension:

```sh
pandoc -f markdown+wikilinks_title_after_pipe -t html wiki-mixed.md
pandoc -f commonmark+wikilinks_title_after_pipe -t html wiki-mixed.md
```

The two commands gave the same HTML:

```html
<p><strong>Before</strong> you merge, read <a href="plan"
class="wikilink">plan</a> and <em>then</em> ask <a href="jane-doe-notes"
class="wikilink">Jane Doe</a>.</p>
<p>Typed as code, <code>[[plan]]</code> stays as text.</p>
```

Bold and italic came out as `<strong>` and `<em>`, and both wikilinks still turned into tags beside them. Both wraps in the first paragraph land inside an `<a>` tag, between its `href` and its `class` attribute. Inside backticks, `[[plan]]` stayed literal in a `<code>` element. A code span kept the brackets visible here even with the extension on.

## What the extension lists say

Typing `pandoc --list-extensions=commonmark` prints one extension per line, a plus sign for on and a minus sign for off. The `markdown` list works the same way. Both readers carry the two wikilinks names switched off:

```text
-wikilinks_title_after_pipe
-wikilinks_title_before_pipe
```

In the saved lists those entries sit at lines 71-72 for `markdown` and lines 28-29 for `commonmark`. A fresh listing in the extra script, filtered for the word wikilinks, printed the same pair for each reader.

A misspelled extension name doesn't pass silently. A control run asked for `+no_such_ext`, and pandoc stopped with `The extension no_such_ext is not supported for markdown.` and exit code 23.

The sibling test on [a Markdown table without a header](markdown-table-without-header.md) reads these same two lists for its table extensions.

## Steps for checking wikilinks in a file

The extra script ran each command below on `wiki.md`. Wherever `wiki.md` appears, use your file's name.

1. Count lines with double brackets: `grep -c '\[\[' wiki.md`. It printed `2`.
2. Convert with the after-pipe extension: `pandoc -f markdown+wikilinks_title_after_pipe -t html wiki.md -o wiki-after.html`.
3. Count the tags pandoc built: `grep -c 'class="wikilink"' wiki-after.html`. It printed `2`, the same as step 1.
4. List each address with its line number: `grep -n 'href=' wiki-after.html`. Line 1 held `href="plan"` and line 2 held `href="jane-doe-notes"`. If an address shows the display words, switch to `wikilinks_title_before_pipe` and redo step 2.
5. Run a control with no extension: `pandoc -f markdown -t html wiki.md -o wiki-plain.html`, then `grep -c 'class="wikilink"' wiki-plain.html`. This time grep counted `0` and returned exit code 1.

## Where Sashmark fits

Sashmark's opening release is intended to let you edit text in the same view you read it in. With the Round-Trip it targets, saving could keep all other bytes of that file as they stood. Changes View, part of that same release plan, could highlight what an agent edited since your most recent pass, with or without git.

It is in development and has not been released. The app itself has no AI features. See the [planned features](/features), the [help pages](/help) and the [roadmap](/roadmap) for where each part stands.

More at [sashmark.com](https://www.sashmark.com/).
