note: This was moved here as part of my HowToSelfPublishABook.org redesign
If you get a minute, you should also go check out his produced ebooks:
Welcome back, fellow eBooklets! …0r whatever we are. Today’s segment of my eBook publishing tutorial gets into the file conversion part of the process, which can be fun or really aggravating depending on your skill, patience and how well you follow instructions.
Let’s get to it then.
Open the File in the Word Processor
First, open the story or manuscript you’re going to convert in Microsoft Word or whatever word processor you’re using. If you’ve created a plain text file, you can skip this step and go on to the next portion of the tutorial. We’ll catch up.
Once the file’s open, you want to create an HTML file from your story which will be manipulated elsewhere. So go to the Save As feature of your chosen word processor and in the file type designator box, choose “HTML” for the file type.
Now save your story as an HTML document. When it’s finished, open your file explorer – My Computer or Windows Explorer for Windows; you weirdos using stuff other than Windows are on your own again.
The file should be named something you can easily recognize and remember. It will have an .htm or .html extension wherever you saved it. Now navigate to it with Windows Explorer.
Check Out the Ugliness
This is an optional step, but it gives you some idea of how bad word processing software is at generating good HTML code.
When you’re finished, you can open the file with your brand-spankin’ new Notepad++ text editor. If you didn’t download it, shame on you, lazy-butt. Open it in whatever plain-text editor you want. Not a word processor, though; that’s critical. If you DID download Notepad++, make sure you select HTML under the Language menu.
With the HTML version open in your text editor screen, you’re going to see a LOT of code you didn’t know was there. Matter of fact, it’s gonna be a hot mess.
Yikes! Look at that!
But don’t despair! We can get rid of almost all of that gobbledygook and clean this up jiffy-quick.
Cleaning It Up
Okay, now we’re going to clean up the HTML from this thing properly.
- Open the file in its native software again – Word, Writer, whatever it was.
- Hold the Ctrl key and press the A key (Ctrtl + A) to select all the text in your file.
- Copy the text (Ctrl + C).
- Close the word processor; click YES if prompted to make all the text available to other applications.
- Open your text editor (Notepad, Notepad++, etc.).
- Paste the text into the text editor (Ctrl + V). This eliminates all unnecessary formatting and word processor-specific coding. If you use Notepad++, check the Language menu to see it’s on Normal Text.
Okay, so you’ve got a nice clean document now. It has no formatting. What’s that you say? You had italics in some places, centered scene break markers, things like that? Too bad, Bucky. They’re all gone now. It might be in the HTML document you made, and it will still be in your original file, but it’s gone from this puppy now.
Some sites, like Smashwords, for instance, call this the “nuclear option”. This removes any and all formatting from your file. The curly quotes will still be there, pointed in the right direction, but pretty much anything else you added, like italics for emphasis or special formatting for chapter titles, things like that … gone. Zap. Pow. Bzz. Pbbt.
Getting It Laid Out
Once that’s done, you need to lay the text out in a way such that the HTML file will have paragraphs in it. If you don’t do this, you’re going to have one long, continuous paragraph. Or you’ll have a bunch of lines broken with line break tags, which might look okay or it might not, depending on how the reader sets the sizing for the text in their Kindle/eReader.
You need to make sure the device knows where to break paragraphs, so they don’t end up in the middle of a line somewhere. You also don’t want any other headaches associated with bad HTML coding. So let’s get this done.
I like to use KompoZer, the HTML editor, for this step. There is also a composer window as part of SeaMonkey, the Mozilla browser no one knows about, but … you know. If you didn’t download KompoZer, you’ll have to do this all by hand. Have fun. Remember, copy and paste is your friend.
- Copy all the text from the text editor (Ctrl + A to select all, then Ctrl + C to copy).
- Open KompoZer.
- Paste the text into the design screen (Ctrl + V).
- Go to the View menu, and choose HTML Tags view.
- Select all the text on the screen (Ctrl + A).
- On the Format menu, choose Paragraph, Paragraph.
- Switch to the Source tab (at the bottom of the window).
- Go to the Edit menu, choose Find and Replace.
- In the Find box type <br>; leave Replace blank. Click Replace All.
- When the search is finished, return to the top of the document and run it again. You should get a message saying it can’t find what you’re looking for.
- Click the Design tab again; you should now have nicely formatted HTML paragraphs.
- Click on the Source tab again and copy all the text from the edit screen (Ctrl + A, Ctrl + C).
The KompoZer Source tab should show something like this:
See the pretty paragraph tags (<p> and </p>)? You’re finished with KompoZer now, but leave it open, just in case of boo-boo later.
Okay, the next steps are pretty easy, and very straightforward, but crucial.
Putting It into a New HTML Document
Open Notepad++. In a blank document, go to the Language menu and choose HTML.
BE CAREFUL! Remember you have your entire story and your HTML code for paragraphs on your clipboard; DO NOT COPY ANYTHING! If you have to delete to correct a mistake, either double-click on the error and re-type, or use the backspace key to erase it. I REPEAT, DO NOT COPY OR CUT ANYTHING DURING THIS PROCESS!
Type the following text into the document, just like you see it:
Don’t worry about the little + and – signs on the far left; that’s a function of Notepad++ and you don’t have to type that part. Just the rest of it.
What you have now is a template you can use for all your Kindle-published stories and manuscripts. It will do all sorts of neat tricks; anything you tag with the HTML heading 1 tag will automatically be changed into all uppercase letters, with a font size of 24 points and be centered. All the h2 tags will be centered; all the paragraphs of the class “auth” will be centered, 10-point italic font; and so on. The Kindle Previewer software had no difficulty with this little style sheet added to the HTML document, but YMMV, so use this template at your own risk. You can eliminate everything between the head tags if you’re worried.
All right, with that done:
- Open the Kindle Stories template you just made (if it’s not open).
- Save the document with a new name.
- Open a new tab in N++.
- Paste the markup text from KompoZer (Ctrl + V).
- Go to the top of the document (Ctrl + Home does this quickly).
- Delete everything from the top of the document to your first paragraph tag (<p>). All this information is already in your template; you don’t need it.
- Select all the remaining text (Ctrl + A) and copy it (Ctrl + C).
- Switch to your Kindle Stories template.
- Move the cursor between the two body tags (<body> and </body>).
- Paste the text from the other tab into the template (Ctrl + V).
- From the Languages menu, choose HTML.
- Save the story in N++ with an .htm extension as file type HTML from the File, Save As menu. You can overwrite your existing HTML version of the story if you’d like.
- Open the new HTML file from My Computer or Windows Explorer with an Internet browser. Or just double-click on it to have it open in your default browser.
- Verify all the necessary formatting is in place — titles, subtitles, chapter names, italics, bold — all were removed and have to be put back manually.
Next time, we’ll do a little HTML markup to make your story pretty again. Hang in there gang, we’re almost finished. See you next time.