DEV Community

Cover image for Command ChatGPT To Render Markdown with 12 Magic Words (including images!)
Rob McCormack
Rob McCormack

Posted on

Command ChatGPT To Render Markdown with 12 Magic Words (including images!)

ChatGPT 4 is required - April 12, 2024 version.

aimarkdown.org

In a hurry...

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 be typed out. But to get ChatGPT to display 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].

Recommended Experience for Challenges

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.


Enter fullscreen mode Exit fullscreen mode
  1. Test it out by copying and pasting the Markdown text and press Enter:


[md]

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

![](https://i.aimarkdown.org/dog-2456264_1280.jpg)

Please respond **briefly**

Thanks!


Enter fullscreen mode Exit fullscreen mode

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 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 !



Enter fullscreen mode Exit fullscreen mode

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://i.aimarkdown.org/dog-2456264_1280.jpg)
[/md]
Give me a short answer to:

1. What is the color #f00?
2. When is Easter in 2024


Enter fullscreen mode Exit fullscreen mode
  • Do you see what happened? Only some of message is rendered.
  • Here is 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
Enter fullscreen mode Exit fullscreen mode




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 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:

Top comments (0)