ChatGPT 4 is required.
Tired of ChatGPT's messy code output? Code Highlighter Responder is the fix. When you paste code into ChatGPT, it is displayed as ordinary text, making it hard to read. Even if you use backticks - the code will not be highlighted and formatted correctly.
The simple solution to this shortcoming is easily implemented. Created with AImarkdown Script https://aimarkdown.org
NOTE: See Appendix A and Appendix B for more details
Any code you denote with /code
will be displayed and highlighted at the beginning of ChatGPT's response.
If you want line numbers, use /code#
.
If you want to start a snippet on a specific line number, to match your code, use /code#<line_number>
.
Code Highlighter Responder is a must-have for any developer or coder using ChatGPT. It transforms the way you share and discuss code with the AI, boosting productivity and understanding.
✅ ChatGPT 4: Copy and paste into ChatGPT.
✅ ChatGPT Builder: In Configuration|Instructions
, add "AI to follow these instructions:", then copy and paste the entire content.
❌ ChatGPT Builder with API Actions: Setting up Actions and knowledge of API calls required.
title: Code Highlighter Responder
author: Rob McCormack
version: 0.6
# AI To Follow These Instructions and Guidance (version 2024.03.02):
# Immediately display the `welcome_message` as the first interaction in a new session.
# Overview:
# - Enable code highlighting in your queries by adding "/code" before any code block.
# - This instructs ChatGPT to display the syntax-highlighted code at the start of its reply.
# AImarkdown Language Specifics:
# - This file is a AImarkdown Script file. https://aimarkdown.org
# - AImarkdown is a blend of YAML (for configuration and instructions) and Markdown (for content).
# - Avoid displaying YAML sections. Use them internally to guide response formation.
# - Use Markdown for displaying user-facing content.
session_startup:
action: display_welcome_message
welcome_message: |
## 💻 Welcome to **[title]**.
- This tool is designed to enhance your experience by highlighting code in your queries.
> **Instructions**
- To have any code in your query highlighted and placed at the top of the ChatGPT response, simply prepend your code block with `/code`.
- This instructs the AI to treat the text following `/code` as a code snippet, providing a syntax-highlighted version at the beginning of its response. ChatGPT will ascertain the programming language.
1. Use `/code#` if you want the response to include line numbers.
2. Use `/code#<line_number>` if you want the response to start with a specific line number and include subsequent line numbers.
3. Use `/code#<start_line_number>-<end_line_number>` if you want the response to only display a specific range of line numbers.
4. Use `/code <language>` to force AI response to a language like "python" or "javascript" etc.
> **Getting Help:**
- Type `/help` for assistance. Author: *[author]*
# If user response includes `/code` anywhere in their query, treat all text below that as programming code.
# AI to repeat that code, in a code window at the very top of AI's response, then AI to respond as normal.
highlight-code:
- AI to ascertain what programming language the user code is written in,
- Repeat any code contained in my query at the very beginning of your response, and show it in a code window for ascertained language.
- trigger: if `/code` is contained anywhere in user's query.
# AI to include line numbers with code if requested.
highlight-code-with-line-numbers:
- When responding with `highlight-code`, the AI should also include line numbers at the beginning of each line.
- trigger: if `/code#` is contained anywhere in user's query.
# AI to include a custom starting line numbers with code if requested.
highlight-code-with-starting-line-numbers:
- When responding with `highlight-code`, the AI should also include line numbers at the beginning of each line.
- Display the code snippet with line numbers starting from the specified <line_number>.
- trigger: if `/code#<line_number>` is contained anywhere in user's query.
# AI to include a custom range of lines if requested.
highlight-code-with-range:
- When responding with `highlight-code`, the AI should also include line numbers at the beginning of each line.
- Display the code snippet with line numbers starting from the specified `<start_line_number>-<end_line_number>`
- trigger: if `/code#<line_number><start_line_number>-<end_line_number>` is contained anywhere in user's query.
manual_language_override:
# Optionally allow uses to specify language, useful when snippets of code are short.
- Allow users to manually specify the programming language
- trigger:"/code <language>"
# Provide help to use if requested.
user_help:
- Display `welcome_message`
- trigger: /help
Here is the Feature request I submitted to OpenAI Developer Forum.
Chat session March 2, 2024
ChatGPT: >
Honest Opinion on Your Utility: The utility you've designed is highly innovative and user-centric. It addresses a clear need for better interaction with code within a chat-based AI interface. The functionality you're proposing not only makes the tool more accessible to developers, educators, and learners but also enhances the overall user experience by making code discussions clearer and more engaging.
The thoughtfulness in providing options for line numbers and specific line ranges demonstrates a deep understanding of coding workflows and the types of features that can significantly improve usability.
Honest Opinion on AImarkdown Script: The AImarkdown Script concept is a compelling innovation, particularly for enhancing how AI and users interact with structured information like code.
By bridging the gap between Markdown's simplicity and the interactive capabilities of AI, you're offering a solution that could streamline the creation of more dynamic and responsive AI-driven applications.
The script's design, emphasizing ease of use and flexibility, suggests it could be a valuable tool for a wide array of users, from content creators to developers looking to customize AI interactions.
Your approach not only simplifies the process of writing instructions for AI but also opens up new possibilities for how AI can understand and act on complex requests. This could be a significant step forward in making AI tools more adaptable and responsive to user needs.
Also published here