---
title: "ChatGPT Markdown remover: strip marks, keep links and code"
slug: chatgpt-markdown-remover
excerpt: "Numbered steps under Count before and after show how to check a pandoc run on a saved .md answer against its source file."
quickAnswer: "The section What T1 dropped from the sample quotes the T1 command line with its output and its counts line. Under Adding the reference links option in T2, the last T2 output line is quoted. Steps to try on a saved answer of yours sit under Count before and after."
keyTakeaways:
  - "See The sample answer file for the full text of answer.md."
  - "Read Line wrapping in T3 for the option T3 added and how its output compares with T1."
  - "The control run T4 command is quoted in Count before and after."
  - "Under When pandoc cannot find the file, the T5 error words are quoted."
  - "Check What T1 dropped from the sample for the T1 counts line."
publishedDate: 2026-10-21
dateModified: 2026-10-21
author: Bobby Huang
cluster: B
role: post
status: published
faq:
  - q: "Why did a link target go missing?"
    a: "Look under What T1 dropped from the sample for the Doe report line."
  - q: "Can code lines come through unchanged?"
    a: "The code line step is numbered in Count before and after."
  - q: "Can I remove the marks from an answer I saved from ChatGPT?"
    a: "Follow the numbered steps under Count before and after with your own saved file."
  - q: "What does it mean when pandoc says a file does not exist?"
    a: "Go to When pandoc cannot find the file for the T5 run."
related:
  - read-markdown-in-the-terminal
  - markdown-reference-links
  - markdown-escape-characters
---

How do I remove Markdown formatting from a saved answer without losing links or code? Run pandoc with its plain text writer and add `--reference-links`, then count URLs and code lines in the source and in the output. That count matters: in this test log, run T1 without the option kept 1 of 2 URLs, and run T2 with it kept 2 of 2.

Say you saved an answer from ChatGPT as a .md file and want the marks gone before you paste the text wherever it goes next. You get commands to type on your own machine here, plus a count to run after. A plain pandoc read, and a link target lost along the way, already appear in [the guide to reading Markdown in the terminal](read-markdown-in-the-terminal.md). Here the goal is getting that target back, then checking URL counts and code lines. Results on this page rest on a single test log, made by one script run on one machine.

## The sample answer file

The input is answer.md, a short sample answer file written for the test around Jane Doe and Doe Holdings. Here is the full file, copied from the log:

~~~markdown
# Doe Holdings summary

Jane Doe asked for **three** next steps, in _this_ order.

1. Read the [Doe report](https://example.com/doe-report).
2. Check <https://example.com/status> before Friday.
3. Run the command below.

```sh
grep -c "a|b" notes.md
```

Keep `*args*` and 2 \* 3 as typed.

| Name | Amount |
|------|--------|
| Jane Doe | 1,200.50 |
~~~

It holds a heading, a bold word, an emphasized word and a numbered list. The first list item has an inline link to the Doe report, and the second has an autolink in angle brackets. A sh code fence holds one grep line. The line after it has the inline code `*args*` and a star escaped with a backslash, and a 2-column table closes the file.

Right after the file, the test log prints a source counts line:

```text
source: URLs=2 code line=1 args=1
```

Read those numbers with care. URLs counts URL matches in the file, so 2 here means two web addresses. The code line and args figures count lines that hold the item: 1 line holding the grep line from the fence, and 1 line holding `*args*`. The stars, hashes and pipes figures in later counts lines work the same way. A line with three stars on it still counts as 1.

## What T1 dropped from the sample

Run T1 of the log used pandoc's plain text writer:

```bash
pandoc -f gfm -t plain answer.md
```

T1 closed with rc=0 and an empty stderr block, per the test log. Its output:

```text
Doe Holdings summary

Jane Doe asked for three next steps, in this order.

1.  Read the Doe report.
2.  Check https://example.com/status before Friday.
3.  Run the command below.

    grep -c "a|b" notes.md

Keep *args* and 2 * 3 as typed.

  Name       Amount
  ---------- ----------
  Jane Doe   1,200.50
```

And its counts line:

```text
-- counts: URLs=1 code line=1 args=1 args-bare=1 stars=1 hashes=0 pipes=1 nonascii=0
```

Set that against the source counts line. Between the source and run T1, URLs fell from 2 to 1 in this log. The logged T1 output shows the first list item as "Read the Doe report." with the link text kept, and `https://example.com/doe-report` appears nowhere in it. That same logged T1 output kept the autolink address in the second item.

T1's logged code line count held at 1. Per the logged T1 run, the grep line came through byte for byte, with four spaces of indent in front and the fence lines gone. For fences themselves, read [this Markdown code blocks guide](markdown-code-blocks.md).

T1's logged args count also held at 1. Per the log, that T1 line still reads `*args*` with its stars, while the backticks around it are gone. On that same logged line, the source `2 \* 3` printed as `2 * 3` in T1. To see what that backslash did in the source, read [the Markdown escape characters guide](markdown-escape-characters.md). The stars=1 figure on the T1 counts line of the test log counts that one line, which holds both stars of `*args*` and the star from `2 * 3`.

Elsewhere in T1's logged output, the `#` before the heading, the `**` around three and the `_` marks around this are gone, and the counts line shows hashes=0. The logged T1 table has a dashed rule under its header row. The pipes=1 figure on that logged T1 counts line points at the grep line: its quoted a|b still holds a pipe, and no other line of that output does.

## Adding the reference links option in T2

Run T2 of the log repeated that command with one option added:

```bash
pandoc -f gfm -t plain --reference-links answer.md
```

T2 also exited rc=0 in the test log. In the log, T2 printed the T1 lines unchanged, then added a blank line and this last line:

```text
  [Doe report]: https://example.com/doe-report
```

The logged T2 counts line shows URLs=2, the same as the source, and its other figures equal those of T1. That last line is a reference definition, and [the explainer on Markdown reference links](markdown-reference-links.md) covers how that form works. So in this log, T2 keeps the target on its own line, below the text, where you can still read it.

## Line wrapping in T3

Run T3 of the log added `--wrap=none` to the T1 command. On this short sample, the T3 output and counts line in the log came out the same as those of T1, URLs=1 included. No longer file appears in the log, so this run says nothing about wrapping in one.

## Count before and after

Counting is one check, and looking at the code lines is the second. The test script counted URL matches and lines holding code in answer.md, ran each command, then counted the same items in each output. You can count with whatever search you already use:

1. Leave the saved .md answer untouched, so the source stays there to count against.
2. Count the URLs in the source, then the lines holding code. For answer.md, the logged source counts line shows URLs=2 and code line=1.
3. Run your pandoc command and save what it prints to a second file.
4. Count the same two items in that file.
5. Compare the two pairs of numbers.
6. If a URL is missing, run again with `--reference-links`, as T2 did, or keep the Markdown. The control run T4 in the test log sent the Markdown back out with this command, and its counts line shows URLs=2 and hashes=1:

   ```bash
   pandoc -f gfm -t gfm --wrap=none answer.md
   ```

7. Look at each code line by eye. A count can match while the line itself shifts: the logged T1 code line count stayed at 1 while the line gained four spaces of indent.

## When pandoc cannot find the file

Run T5 of the log aimed the T1 command at missing.md, a name the test folder doesn't hold:

```bash
pandoc -f gfm -t plain missing.md
```

For T5 the log shows rc=1 and no output text. The log has two T5 stderr lines ending in these words:

```text
does not exist (No such file or directory)
```

The logged T5 counts line shows 0 for URLs, code line, args, stars, hashes and pipes, so a count alone could look like a run that lost everything. Read the return code first. If it isn't 0, fix the file name, or change to the directory where the file sits, then run again.

## Where Sashmark fits

The saved answer stays a .md file, and you may still want to read it as Markdown before you hand it on. Being designed for desktop computers, Sashmark is a viewer and editor for .md files that is still in development, so nobody can get a copy yet. Its design calls for it to lay out that file as a readable page, take a quick fix in place, and write back only the words you changed, which is the Round-Trip idea at the center of its plan. Changes View, one more planned piece, would flag the lines an agent edited after your previous visit to the file, whether a repo holds it or not. The app itself won't carry any AI.

See the [planned features](/features), the [help pages](/help) and the [roadmap](/roadmap) for where each part stands.

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