A README is one of the few places where a picture made of text looks like it belongs: a small portrait or mascot above the install instructions, in the same characters as the code below it.

The catch is how it gets there. You make the art in an ASCII art maker, copy it, paste it into the README, and the picture arrives bent out of shape. This post walks through the steps that keep it intact.

Why it breaks

ASCII art is drawn on a grid where every character is the same width, which is what a monospace font gives you. Ordinary Markdown text is shown in a proportional font, and lines that follow each other are read as running text, so the grid is gone before the reader sees it.

People hit this wall everywhere, not only in READMEs. A poster on r/ASCII asked "How to paste ASCII art?" and wrote:

"Whenver I paste it, it just gets messed up, what do I do? Sry if this is a common question"

The fix is to tell Markdown to leave the text alone. A fenced code block does that: its lines are kept as they are and shown in monospace.

Step 1: Pick and prepare the photo

What goes in decides how readable the characters are. A clear subject on a simple background converts more cleanly than a busy scene. If the background is cluttered, remove it before you convert, so the character grid is spent on the person, pet or logo and not on the wall behind it.

Step 2: Convert it

Open the ASCII Art Maker and add your photo. The conversion runs in your browser and no file is uploaded.

ASCII Art Maker with Characters per line set to 80, the Classic character set selected and TXT as the export format

The settings used for a README header. The preview is a plain test shape, not a photo.

These are the settings to look at:

  • Characters per line: 80. It is the starting value, and the page describes it as a familiar terminal width. A wider setting makes longer lines, and a code block wider than the page can force sideways scrolling.
  • Character set: Classic. This is the one selected when you start. Blocks, Dots, Binary, Braille and Custom are the other options.
  • Keep image colors: off. Color is meant for HTML or PNG output. A README code block holds plain text.
  • Invert light and dark: switch it on when the art will sit on a dark background. If your platform offers both a light and a dark theme, preview the README in each.

If a face still looks muddy, try the Braille set, which packs more dots into each cell, or a wider width, and keep an eye on how long the lines get. Size matters in a README in both directions: a wide block scrolls sideways, and a tall one pushes your install instructions down the page.

Step 3: Copy the text

Copy the art to the clipboard, or download it as a .txt file and open that. Either way it is plain text.

Step 4: Paste it inside a fence

Open the README and put the art between two fence lines. Each fence line is three backticks, written at the left edge with nothing in front of it. This is the layout, shown inside a different kind of fence so it stays visible:

``` (the art goes here, exactly as copied) ``` 

Two slips are common:

  • The fence is missing, so the art is read as running text and its lines run together.
  • The closing fence is missing, so the rest of the README turns into code.

Then preview the README before you commit, and look at it the way a reader will.

A project name works too

The same page can also turn a line of text into a large FIGlet banner, which suits a project name at the top of a README. The fence rule is the same: banner text goes inside the code block.

When a code block isn't an option

Sometimes the art is going somewhere you don't control: a place that doesn't render Markdown, a chat app, or a mobile app with no monospace font. Download the PNG instead and add it as a normal image:

![ASCII portrait of the project mascot](ascii-portrait.png) 

A PNG is the right download when you cannot control the font on the other side. The trade-off is that its text can't be selected or copied.

Do it with your own photo

Open ASCII Art Maker, add a photo with a clear subject, set the width, copy the result and paste it inside a code block. If you can't control the font where it will be shown, download the PNG.

I'm on the team that makes Pixoffline, the site that hosts the ASCII Art Maker page linked above.