Why Markdown is the language of AI

Markdown has emerged as the most popular way to write prompts for AI systems. For example, recent leaks of OpenAI’s system prompts show extensive use of Markdown for structuring prompts. Although English is the base language used, Markdown provides a simple way to add structure and formatting to prompts.

Benefits of Markdown

Markdown is great for AI prompts because:

  • It allows distinct sections of the prompt to be marked up, making the structure and intent clearer for AI.

  • Markdown can prevent prompt injection attacks by signaling when user input begins and ends.

  • Markdown is lightweight and simpler than other markup languages like HTML and XML. It doesn’t require opening and closing tags.

Markdown is great for AI outputs because:

  • Allows responses to be formatted, creating structured outputs that are easier to read.

  • Its universal format makes it easy to copy/paste outputs across applications.

Markdown Basics

Markdown is a lightweight markup language, similar to HTML and XML, but with a simpler syntax. Mark up languages allows you to “mark up” different parts of the text to communicate structure (i.e. sections, headers, lists). Here is the bare minimum you have to know to start integrating Markdown into your AI workflow.

Headers

Use headers (Heading 1, Heading 2, Heading 3 …) to specify distinct sections of your text. Here is an example of how to specify headers in your text in Markdown and HTML.

Markdown

# This is heading 1
## This is heading 2
### This is heading 3

HTML

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>

Lists

You can use Markdown to specify unordered lists (bullet points) and ordered lists.

Markdown

Unordered List:

* Item
* Item
* Item

Ordered List:

1. Item 1
2. Item 2
3. Item 3

HTML

Unordered List:

<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>

Ordered List:

<ol>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>

How to use Markdown

You can use Markdown to structure your prompts and you can use Markdown to structure your outputs. Here is an example of a prompt written in Markdown.

# Role
You are an amazing ghost writer that writes jokes for stand up comedians. Your job is to provide content that a stand up comedian can riff off of. These can be specific punchlines, general topics to talk about, recommendations on how to deliver the joke, etc.

# Intent
Provide the standup comedian with content. The standup comedian has provided the following constraints:

Rating (think of this as movie ratings): {{rating}}
Context for jokes: {{context}}

# Steps
1. Pick multiple points of view
2. For each point of view find the comedic conflict
3. For each point of view write some punchlines verbatim

Here is a prompt written in Markdown but it also asks for the output to be formatted in Markdown.

You are an experienced teacher that helps come up with an answer sheet for the questions provided here:
{{context}}

For each question do the following:
* Come up with a good answer which is an answer that is bare minimum.
* Come up with a better answer that is more correct / detailed than the good answer.
* Come up with a best answer that is the perfect answer to the question.
* Come up with potential misconceptions students may have

Format the output like the following:

--
$question

## Good
$good_answer

## Better
$better_answer

## Best
$best_answer

## Misconceptions
$potential_misconceptions

Utilizing Markdown knowledge can greatly improve the quality of prompts and outputs. Make sure to give Markdown a try next time you interact with AI.