Write a Love Letter in Plain Text: Line Breaks, Poems, and Printing
A love letter in plain text is a file you own: write it in Markdown, end each poem line with a backslash so the lines stay put, and print it from a clean preview. The one thing that trips people up is line breaks, so most of this article is about them.
Start the letter in a plain file
Open a new note and save it as a .md or .txt file. A letter has a simple shape: a greeting, a few paragraphs, a sign-off. In Markdown, a blank line separates paragraphs, so you don't need any special syntax.
My dearest Sam,
I found the card you hid in my coat pocket in January.
I still carry it.
Yours,
AlexBecause the file is plain text, it opens in any editor on any device, and it doesn't depend on one app staying around. That matters for a letter you may want to reread in ten years.
Soft breaks vs hard breaks
Here's the catch. In the first example, "I found the card..." and "I still carry it." are on separate lines in your file, but a Markdown renderer treats that as one paragraph. The CommonMark spec calls a plain line ending a soft break, and says a renderer may output it as a line ending or as a space. So your two lines can run together into one. If you've hit this before, see why Markdown lines run together.
To force a line to stay on its own, use a hard break. There are two ways:
- End the line with a backslash. The spec is direct: "A backslash at the end of the line is a hard line break."
- End the line with two or more spaces. This is the original rule from Daring Fireball's Markdown syntax page: "you end a line with two or more spaces, then type return."
Both work. For a poem, pick the backslash. Trailing spaces are invisible, and an editor that trims whitespace on save can strip them without telling you. A backslash stays where you can see it.
Two limits to know about. Neither form works at the end of a paragraph or other block, so the last line of a stanza needs nothing. And a line ending inside a code span doesn't produce a break.
Here is a short poem inside the letter:
Your handwriting on the grocery list,\
the blue pen you never return,\
the way you say my name\
like it's a whole sentence.
I'd choose that every morning,\
plain and unadorned.Each line ending with a backslash renders on its own line. The blank line between the two stanzas starts a new paragraph, which shows as a gap. The last line of each stanza has no backslash.
When spacing must stay exact
Some poems depend on indentation or spacing: a line pushed to the right, a short line centered by hand. Markdown collapses that spacing in normal text. You have two options.
- Put the poem in a fenced code block. The spec keeps the content of a fenced block literally, so every space and line ending stays as typed. The cost is a monospace look, which can feel more like code than a card.
- If you publish the letter on a web page, the CSS
white-spaceproperty can keep line endings. According to MDN,pre-wrappreserves spaces and newlines and still wraps long lines, whilepre-linepreserves newlines but collapses runs of spaces.
For most letters, backslash breaks and blank lines are enough. If you like building shapes from characters, see drawing with plain text.
Print or save it as a PDF
Preview the letter first, then read it top to bottom, slowly, the way the person will read it. Check that every poem line sits where you meant it to, and that no stray backslash shows up at the end of a line.
When you print, you're printing the rendered page, so the page styles matter. On the web, MDN's guide to printing explains that @media print sets styles used only for printed content, whether on paper or as a PDF, and that @page controls page size, orientation, and margins. That's how you hide navigation and keep only the letter.
A few practical checks before you print:
- Use a readable body size and generous margins.
- Look at where the page breaks fall so a stanza isn't split across two pages.
- Save a PDF first, and print that file.
The same steps apply to other seasonal writing, as in printing a holiday letter cleanly.
Doing this with Carets
Carets is a native notes and code editor for iPhone, iPad, and Mac that handles Markdown and plain text, so a letter is just a file you can write and keep. You can draft on your phone, finish on your Mac, and your file stays plain text, portable and future-proof. Carets organizes notes into files, projects, and tags, so you can keep a folder of letters, one per year.
Because it's native, it opens quickly when a line of a poem comes to you on the train. Write the poem with backslash breaks, check the preview, and save or print the result.
Get Carets on the App Store for iPhone, iPad, and Mac.
Frequently Asked Questions
How do I keep each line of a poem on its own line in Markdown?
End each line with a backslash, or with two or more spaces, except the last line of the stanza. Use a blank line between stanzas.
Why do my line breaks disappear?
A plain line ending is a soft break, and a renderer may show it as a space. Add a backslash or two trailing spaces for a hard break.
Is a plain-text love letter still readable in ten years?
Yes. A .md or .txt file opens in any editor, so the letter doesn't depend on one app.