Lesson 3
Markdown Headers in Output Formatting
Introduction

This lesson equips prompt engineers with techniques for directing LLMs to produce outputs structured with markdown headers. The goal is to enhance response readability and organization through precise prompt crafting. Also, using markdown headers in your output can make parsing output much easier.

Key Principle

The success in generating markdown header-formatted outputs lies in the explicit instruction within your prompts as well as in providing examples:

Let's dive directly into examples demonstrating how to incorporate markdown header formatting instructions into your prompts.

Basic Prompt Without Formatting Request:

Let's say you are writing a biology report and want to collaborate with an LLM in doing so but you want your report to be nicely structured in markdown. Your initial prompt might be as follows:

Markdown
1__ASK__ 2Describe the process of photosynthesis.

This prompt will yield a narrative or list, lacking structured hierarchy.

Enhanced Prompt With Formatting Request:
Markdown
1__ASK__ 2Outline the process of photosynthesis using markdown headers for each main step. 3 4__FORMAT EXAMPLE__ 5 6# Photosynthesis Process 7## Light Absorption 8Description... 9## Carbon Dioxide Fixation 10Description... 11...

By including a clear formatting request and a structural example, the prompt is more likely to elicit a response that is well-organized and easy to navigate.

Advanced Structuring:

What if you only want to use a specific header like an h2 type header (in markdown that's ##) instead of the variety that is produced by the prompt above?

Markdown
1__ASK__ 2Detail the journey of a red blood cell through the human body using markdown headers for each organ system it passes through. 3 4__CONSTRAINTS__ 5- Only use h2 type headers (`##`) in the markdown. 6- Also include markdown tables for better information organization. 7 8__FORMAT EXAMPLE__ 9 10## Journey of a Red Blood Cell 11## Heart 12## Right Atrium to Right Ventricle 13## Lungs 14## Gas Exchange 15... 16

This prompt demonstrates how adding a constraints section can make your desired output even more controlled.

Conclusion

Crafting prompts that lead to markdown header-organized responses is straightforward but requires explicit formatting requests. Experiment with different levels of header specifications to achieve the desired depth of information structuring. Mastery comes with practice, and the precision in your prompts will yield increasingly structured and useful outputs from LLMs.

Enjoy this lesson? Now it's time to practice with Cosmo!
Practice is how you turn knowledge into actual skills.