One prompt doesn't reliably return markdown

I need a response to have formatting but I don’t want to be so prescriptive as to use functions with specific arguments. I tried putting “return HTML” in the prompt but this was tricky to work with as sometimes it would have the HTML and body tags and other times not.

Markdown seemed like a suitable format so I added this to the prompt which has been working great:

Return the text as Markdown. The allowed elements are:
h1, h2, h3, p, ul, ol, li

I have a 2nd very similar prompt which I tried adding to the same text to but it didn’t work. It either returns HTML or invalid markdown eg:

h2 Page title

I tried altering the prompt slightly:

The output should be valid markdown. The allowed markdown elements are:
h1, h2, h3, p, ul, ol, li

Now it doenst return HTML but it still returns invalid markdown eg:

h1. Page title

Has anyone run into issues generating markdown?

Also why would ChatGPT be fine with one prompt but not with a very similar one?

Try replacing the shorthand with the names of the elements.

The output should implement only the following markdown elements:

  • headings 1 to 3
  • paragraph
  • underline
  • etc.

Give that a try. You can also use markdown in your prompts, so * for a bullet point. Let me know if that works.

1 Like

Sometimes just saying markdown doesnt register. Try markdown block, or markdown text block.

@Angry_Veteran I got it working with this:

Formatting:

Create a title related to the text. Omit the word "title".

The output should be valid markdown. The allowed markdown elements are:

# H1

## H2

### H3

A paragraph

1. Ordered List Item 1
2. Ordered List Item 2

 - Unordered List Item 1
 - Unordered List Item 2
4 Likes

Since when was this valid markdown?

1 Like

Nice! I’d only suggest putting all the markdown elements together in a code block, but if it is working, no need to add tokens.