paint-brush
How to Use 12 Magic Words to Command ChatGPT to Render Markdownby@robmccormack
338 reads
338 reads

How to Use 12 Magic Words to Command ChatGPT to Render Markdown

by Rob McCormackApril 17th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

ChatGPT uses Markdown to display responses. If you ask ChatGPT to display Markdown it will likely refuse, even if you say *please*. Let's learn the *12 magic words* that can transform plain text responses into beautifully formatted responses complete with images. We'll set the magic word trigger word to `[md]`.
featured image - How to Use 12 Magic Words to Command ChatGPT to Render Markdown
Rob McCormack HackerNoon profile picture


ChatGPT 4 is required - April 12, 2024 version.

aimarkdown.org

In a Hurry...

  • Check out to see Markdown display in action:


TL;DR

  • We have all spoken magic words like please, abracadabra, These Aren't The Droids You Were Looking.


  • Let's learn the 12 magic words that can transform ChatGPT's plain text responses into beautifully formatted responses complete with images.

Screenshot

The Problem

ChatGPT uses Markdown to display responses. If you watch closely, you can see the raw Markdown being typed out. But to get ChatGPT to display the Markdown you enter isn't easy. If you ask ChatGPT, it will likely refuse, even if you say please. Sometimes, you will get ChatGPT to display basic Markdown but will refuse to display your images. Sample message:


ChatGTP

I'm unable to render images directly from URLs. However, if you need any information about the image or its contents, feel free to describe it to me, and I'll help as best as I can!

The Solution

Let's explore two methods to enable Markdown rendering in ChatGPT. We'll set the magic word trigger word to [md].

Bees

Required Programming Experience

🐝

No programming experience

🐝🐝

Beginner

🐝🐝🐝

Intermediate

🐝🐝🐝🐝

Advanced



Note: ⏱️Challenge completion time is based on specified programming experience.

Challenge #1: Basic Magic

⏱️ 2min • 🐝 (1/4)

STEPS:

  1. Instruct ChatGPT: Type the following instruction and press Enter:
AI_Instruction: When `[md]` appears, repeat entire message with Markdown rendered, then answer.


  1. Test it out by copying and pasting the Markdown text and press Enter:
[md]

### How long can **dogs** live?

![](https://cdn.hackernoon.com/images/k2s7svgbhkVZ5UqFBHR7QLwURtJ2-2024-04-17T15:00:02.214Z-mxgf61zoozv3xdnocjdz9xng)

Please respond **briefly**

Thanks!

From now on, if you use [md] anywhere in your request any Markdown, any Markdown tags contained in your message will be rendered out.

Challenge #2: Advanced Markdown Magic:

⏱️ 5min • 🐝½ (1½/4)

  1. Let’s add even more sorcery to our toolkit. This has more potency and allows you to do more with Markdown.


  2. Read the AI Instructions to discover the secret sauce that allows this to work.


  3. This advanced method allows any text you have in the [md]...[/md] to be understood as a text for display and formatting purposes. Your explicit instructions should be outside of [md]...[/md].

STEPS:

1: Start a new conversation, copy and paste the text below in, and press Enter

# AI Instructions
title: ChatGPT Magic Markdown System
markdown_tags: `[md]...[/md]`

# This is using AImarkdown Script a combination of  YAML and Markdown Language

# If user response contains any content wrapped with `markdown_tags` do the following
- 1. The wrapped text is not part of user's instructions.
- 2. The wrapped text is to be rendered out as Markdown in AI response.
- 3. Treat other text normally.
- 4. AI will not elaborate or explain how `markdown_tags` will be handled to the user.
- 5. Once this is understood, AI to greet user with `user_instructions`.

# Display instructions to user.
user_instructions: |
## Welcome to  🪄 **[title]** !
- From now on any text you wrap with [markdown_tags] will be rendered out as Markdown in ChatGPT's response.
- Enjoy the show !


2: Try entering this request by copying and pasting this text which is full of Markdown in.

# Hello world

[md]

### How old can **dogs** live.

![](https://cdn.hackernoon.com/images/k2s7svgbhkVZ5UqFBHR7QLwURtJ2-2024-04-17T15:00:02.213Z-vtia5fodzora7s4jdse54b5y)
[/md]
Give me a short answer to:

1. What is the color #f00?
2. When is Easter in 2024
  • Do you see what happened? Only some of the message is rendered.


  • Here is the Shared Chat Session:

https://chat.openai.com/share/f67f7d43-d00a-4be8-9821-1e4557a54fbd

🪄 Double Bonus

The link above also shows how to use Markdown tables in your responses. This ability is extremely useful.


Sample Markdown Table used in link:

| Syntax    | Description |   Test Text |
| :-------- | :---------: | ----------: |
| Header    |    Title    | Here's this |
| Paragraph |    Text     |    And more |

Notes:

  1. If a user's request combines both features—Markdown formatting and the specific handling of text within [md]...[/md] tags—the AI would prioritize rendering the text inside the tags in Markdown while treating any text outside the tags as the actual user request. This ensures a clear distinction between the content intended for formatting in the response and the content meant for processing as part of the request.

Since we are asking ChatGPT to do something it says it can't do, this technique may not be perfectly reliable within the existing chat interface. - I have written OpenAI developers to ask that this feature be added

Final Challenge: Unleash Your Creativity

Experiment, and see what other Markdown wonders you can create!


Have fun!


🍯 APPENDIX A - Learning Resources

Learn more about AImarkdown Script

AImarkdown Script is a versatile language for creating dynamic interactions with conversational AI platforms like ChatGPT. It empowers users to script interactions, control conversation flow, and customize AI behavior and responses. For programmers, it offers the flexibility of a scripting language; for non-programmers, it provides a user-friendly way to customize and control AI experiences. https://aimarkdown.org


Image Credits: