Observed Formatting Problems
Problem Songs (Poor Formatting)
-
“Beth I Hear you
-
“Wonderful Lily”
-
“Unicorn Song, The” – Multiple
Well-Formatted Songs
-
“Lady”
- “Achy Breaky Heart” – Excellent
Root Causes of Formatting Anomalies
1. Missing <pre>
Tags
Songs without proper preformatted text tags lose their spacing and
line structure during HTML-to-PDF conversion.
Use Tags
- <pre><span style=”font-family: trebuchet ms, geneva, sans-serif;”><span style=”font-size: 14pt; font-weight: 900;”>
- Close withย </span></span></pre>
-
2. Inconsistent Line Break Usage
-
Single
<br>
tags vs. double<br></br> -
Mix of
<br>and
paragraph breaks - Missing line breaks between sections
3. Whitespace Not Preserved
HTML collapses multiple spaces by default. Without proper
preservation, chord positioning above lyrics fails.4. Inconsistent Section Separators
Some songs use dashes (
โ โ โ โ), others use
nothing, creating visual inconsistency.
Critical Formatting Rules
The WordPress HTML Template (MANDATORY STRUCTURE)
Use this exact structure for every song post:
<pre style="font-family: 'trebuchet ms, geneva, sans-serif; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;">[SONG TITLE]Artist: [ARTIST NAME]Key: [KEY] | Capo: [POSITION] | Difficulty: [LEVEL]Have everything exactly as you want it to print inside the <PRE> tags. </pre>
Why each attribute matters:
-
font-family: 'trebuchet ms, geneva, sans-serif;' -
Consistent look and feel. -
If monospace spacing is essential, use 'Courier New'– Ensures fixed-width characters for chord
monospace
alignment -
font-size: 14px–
Readable size that fits well on page -
line-height: 1.6–
Proper spacing between lines -
white-space: pre-wrap
– Preserves spaces while allowing text wrapping word-wrap: break-word– Prevents long words from
breaking layout
Rule 3: Section Separators
Use this exact separator between all sections:
================================================================================-
Exactly 80 equals signs
-
One blank line before
-
One blank line after
- Creates clear visual separation
Rule 4: Chord Positioning
Chords must be positioned using spaces only (not
tabs):โ CORRECT:
C DmBeth I hear you callin'Em Am GBut I can't come home right nowโ WRONG:
C DmBeth I hear you callin'Em Am GBut I can't come home right nowMethod: Count spaces to position chords directly
above where they change in the lyric line.
Rule 5: Blank Lines for Readability
Use blank lines strategically:
[VERSE 1]โ 1 blank line after section headerC DmBeth I hear you callin'Em Am GBut I can't come home right nowโ 1 blank line between chord/lyric pairsF GMe and the boys are playin'
Rule 6: Section Header Format
Headers should be in square brackets with consistent
capitalization:[INTRO][VERSE 1][VERSE 2][PRE-CHORUS]{ CHORUS }[BRIDGE][INSTRUMENTAL][OUTRO][FINAL VERSE]
WordPress Editor Settings
Block Editor (Gutenberg)
-
Add a Custom HTML block
(not a paragraph block) -
Click the three dots (โฎ) in the
block toolbar -
Select “Edit as HTML”
- Paste your formatted song content
Classic Editor
-
Click the “Text” tab
(not “Visual”) -
Paste your formatted song content
- NEVER switch back to Visual editor after
pasting
Critical Warning
โ ๏ธ NEVER use the Visual Editor after adding your
formatted song contentThe Visual Editor will:
-
Strip your
<pre>
tags -
Collapse multiple spaces
-
Remove line breaks
- Destroy chord alignment
Quality Control Checklist
Before publishing any song post, verify:
-
[ ] Entire song is wrapped in
<pre>tags with proper style attributes -
[ ] All sections separated by
80-character separator lines -
[ ] Chords positioned with spaces
(no tabs) -
[ ] Section headers in square
brackets -
[ ] Consistent blank line spacing
-
[ ] Song metadata at top (Title,
Artist, Key, Capo, Difficulty) -
[ ] Preview in WordPress shows
proper formatting - [ ] Test PDF generation shows proper spacing
Testing Your Format
Step 1: Visual Inspection in WordPress
After saving as draft, check that:
-
Chords appear directly above their
corresponding lyrics -
Lines don’t run together
- Sections are clearly separated
Step 2: PDF Test Generation
Generate a test PDF with just 1-2 songs:
-
Chords should remain above lyrics
-
No text should run together
-
Section separators should be clear
- Page breaks should not split chord/lyric pairs
Step 3: Font Rendering Test
View the PDF at 100% zoom:
-
All characters should be same
width (monospace) -
Vertical alignment should be
perfect - No characters should overlap
Common Mistakes and Solutions
Mistake 1: Copying from Tab Sites
Problem: Copying from Ultimate Guitar or similar
sites often includes hidden formatting.Solution:
-
Copy text to Notepad or TextEdit
first -
This strips all formatting
-
Then apply the template structure
- Position chords manually with spaces
Mistake 2: Using Word Processors
Problem: Copying from Microsoft Word or Google
Docs includes formatting codes.Solution:
-
Use plain text editor (Notepad,
TextEdit, VS Code) -
Save as .txt file
- Copy from .txt into WordPress HTML editor
Mistake 3: Tab Characters
Problem: Tab characters appear as spaces but have
variable width.Solution:
-
Search and replace all tabs with
spaces in text editor -
In most editors: Find
\t,
Replace with 4 spaces - Manually adjust chord positions after replacement
Mistake 4: Smart Quotes
Problem: Curly quotes (
""
'') from word processors cause issues.Solution: Search and replace:
-
"and"
โ" 'and'โ'
Mistake 5: Special Dashes
Problem: Em-dashes (โ) and en-dashes (โ)
instead of hyphens.Solution: Replace all with standard hyphen-minus
(-)
Template Examples
Example 1: Simple Song Format
<pre style="font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;">WONDERWALLArtist: OasisKey: Em | Capo: 2nd fret | Difficulty: Beginner================================================================================[INTRO]Em7 G Dsus4 A7sus4 (x2)================================================================================[VERSE 1]Em7 GToday is gonna be the dayDsus4 A7sus4That they're gonna throw it back to youEm7 GBy now you should've somehowDsus4 A7sus4Realized what you gotta do================================================================================{ CHORUS }C D EmBecause maybe, you're gonna be the one that saves meC D EmAnd after allC D EmYou're my wonderwall================================================================================</pre>Example 2: Song with Comments
<pre style="font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;">LET IT BEArtist: The BeatlesKey: C | Capo: None | Difficulty: Easy================================================================================[INTRO]C G Am F C G F C================================================================================[VERSE 1]C GWhen I find myself in times of troubleAm FMother Mary comes to meC G F CSpeaking words of wisdom, let it be*Note: Play G gently on "wisdom"*================================================================================[CHORUS - REPEAT 2X]F C GLet it be, let it beAm FLet it be, let it beC G F CWhisper words of wisdom, let it be================================================================================</pre>
Advanced Formatting
Handling Long Lines
If a line of chords or lyrics exceeds 80 characters:
C G AmThis is a very long line of lyrics that needs to continue on and onF C GAnd it keeps going even longer than you might expectThe
word-wrap: break-wordin your style will handle this
automatically.
Multiple Chord Changes Per Syllable
When chords change rapidly:
C C/B Am Am/GThe chord changes are quick hereUse double space between chords when they’re very close together.
Instrumental Breaks with Notation
[INSTRUMENTAL - 8 bars]| C | G | Am | F || C | G | F | C |*Guitar solo over verse progression*
Troubleshooting Guide
Issue: Chords Don’t Align in PDF
Diagnosis: Using proportional font or missing
<pre>tagsFix:
-
Ensure
<pre>
tag includesfont-family: 'Courier New', monospace -
Verify all chords positioned with
spaces (no tabs) - Check that font-family is being preserved in PDF generation
Issue: Text Runs Together
Diagnosis: Line breaks being stripped during
conversionFix:
-
Verify content is inside
<pre>
tags -
Check that
white-space:is in style attribute
pre-wrap - Ensure line breaks exist in source (view HTML)
Issue: Sections Not Separated
Diagnosis: Missing or inconsistent separators
Fix:
-
Add exactly 80 equals signs
between sections -
Ensure blank line before and after
each separator - Use consistent separator throughout song
Issue: Special Characters Garbled
Diagnosis: Encoding issues or smart quotes
Fix:
-
Replace all smart quotes with
straight quotes -
Replace special apostrophes with
standard' - Ensure WordPress post is saved with UTF-8 encoding
Issue: Inconsistent Font Size
Diagnosis: Multiple font-size declarations or
missing styleFix:
-
Set font-size once in
<pre>
tag style attribute -
Remove any internal
<span>
tags with size declarations - Test that 14px renders properly in both WordPress and PDF
Automation Tips
Text Editor Macros
Create macros in your text editor for:
-
Adding
<pre>
wrapper with full style -
Adding section separators
- Converting tabs to spaces
Example VS Code Snippet
{"Song Template": {"prefix": "song","body": ["<pre style=\"font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word;\">","${1:SONG TITLE}","Artist: ${2:Artist Name}","Key: ${3:C} | Capo: ${4:None} | Difficulty: ${5:Beginner}","","================================================================================","","[VERSE 1]","","$0","","================================================================================","</pre>"]}}
WordPress Bulk Update
If you need to fix multiple existing posts:
Manual Method
-
Open each post in HTML edit mode
-
Select all content
-
Wrap in proper
<pre>
tag with styles -
Add section separators if missing
-
Fix chord spacing with spaces
- Save and test PDF generation
Programmatic Method (Advanced)
If you have database access, you can create a SQL script to:
-
Add
<pre>
wrapper to all posts in specific category -
Standardize section separators
- Bulk test PDF generation
โ ๏ธ Always backup database before bulk updates
Final Recommendations
DO
โ Always use the complete
<pre>tag with all
style attributes โ Position chords with spaces only โ Use
consistent 80-character separators โ Test PDF output before
publishing โ Keep a template file to copy from โ Use plain text
editor for initial formattingDON’T
โ Ever use WordPress Visual Editor after adding formatted
content โ Use tabs for positioning chords โ Copy directly from
word processors โ Mix different formatting styles within a song โ
Forget to include metadata (Artist, Key, Capo) โ Skip the quality
control checklist
Summary
The key to consistent, professional-looking song chord sheets in
your PDF e-books is:-
Structural Consistency
– Same HTML structure for every song -
Proper Tag Usage
– Complete<pre>tag with all style attributes -
Monospace Font –
Ensures chord alignment -
Space-Based Positioning
– Never tabs -
Clear Separators
– Visual section breaks - Testing – Always verify in PDF before final
publication
By following this guide exactly, you will eliminate all formatting
anomalies and produce professional-quality PDF songbooks from your
WordPress posts.
Document Version: 1.0
Last Updated:
November 1, 2025
For: E-Book Maker WordPress
Plugin v1.0.6+ -