10

I've tried the usual markdown syntax, for example:

```py
# Here's my Python code
import this
```

But it doesn't seem to work, it just displays it literally as if it was plain text. I wasn't able to find information as to whether markdown was the right syntax, or if there's another one, or if there simply isn't one. But when it replies with code, it does display it in a proper format (monospace font and everything), so that seems to indicate that there might be a way.

Of course this doesn't hinder its comprehension of code in any way, it's just for me, if I want to review the conversation later.

I have also looked through ChatGPT's FAQ (as suggested in the comments), especially through these three pages:

But haven't found any additional information on how to format prompts.


There is a very recent discussion (dated February 21) exactly about this in the OpenAI Community -> Add markdown support to input bar.

So far there is no working solution / workaround, and there is no fuller explanation either.

Also there is a very recent discussion (dated February 13) exactly about this in the OpenAI Discord Server -> https://discord.com/channels/974519864045756446/1074756725695062096/1074764240063299584

On this conversation it is mentioned the case of of LaTex for Match formulas. So far ther is no workink solution / workaround, and there is no fuller explanation either.

Editor Note: I have tested using single backtick and triple backtick / code fences as the OP but they didn't work for me either.

6

4 Answers 4

5

We have learned from the current documentation and posts from OpenAI docs, community (forum) and Discord Server, that "vanilla" ChatGPT, the current version without any hack, third party tool, doesn't include a way for end-users to format input (prompts).

One thing that you might try is to use web browser developer tools to edit the HTML/CSS for the node corresponding to a specific prompt, i.e., to take a screenshot.

A more advanced option might be to use a userscript (or userstyle). Some browsers allow the use of userscripts / userstyles without extensions, others require extensions.

A third option might be the use of third party tools like web browser extensions which I don't feel comfortable to use because, IMO, there are a lot of content that is misusing the term ChatGPT, some due to honest mistakes, some as a "marketing strategy" / clickbait) some doing social engineering (trick users to give personal / sensitive information to later use it maliciously).

Related

About browser extensions

From Information Security Stack Exchange

2

it's just for me, if I want to review the conversation later.

My approach is to ask chatGPT directly to pretty print the code. Then I can see it easily.

Screenshot of a chatgpt window where I ask the AI to pretty print the code.

1
  • I just noticed that, as it usually does, it also modified your code a little: for instance, the function was renamed updatescore -> updateScore. Mar 13 at 9:22
0

Me: Can I show you my code in the same format that you present code? If so, how?

GPT: Yes, you can show me your code in the same format that I present code. To do so, you can use a code block. To create a code block, you can enclose your code in triple backticks (''' language Code Here'''). This will make it easier to read and understand your code. If you have any further questions, feel free to ask!

Me: Like this?

(' ' ' cpp

#include

int main() {

std::cout << "Hello, World! The Moon says Hello!";

return 0;

}

' ' ' )

GPT: Yes! enter image description here

4
  • Welcome to Web Applications Please provide a brief context about the content of your answer / explain how this answer the question. Apr 7, 2023 at 16:18
  • 2
    Yes but here your showing its answer, but when you entered the code it wasn't formatted properly. I know because I've asked it too. And when I tried what it told me to do, it never worked. Apr 8, 2023 at 18:11
  • "Yes but here your showing its answer, but when you entered the code it wasn't formatted properly. I know because I've asked it too. And when I tried what it told me to do, it never worked." Why did you put the answer in a comment and some AI generated garbage in the answer?
    – Oskar Skog
    May 18, 2023 at 15:11
  • 1
    @BlindSpots I think this might be a rare exception to the rule.
    – Maybe
    Nov 11, 2023 at 17:16
0

You might find this useful as a partial solution.

I am the author of AImarkdown Script- MIT LICENSE

https://dev.to/aimarkdown/code-highlighter-responder-chatgpts-missing-feature-8dg

enter image description here

1
  • Welcome to Web Apps SE! If you want to recommend your own product or website, there are some guidelines in place for doing so. Following them will help you avoid giving the impression that you're spamming. Please edit your post to explicitly state your affiliation. (If you're not actually affiliated, it may be worth mentioning that as well.) Mar 17 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.