A butcher, yes, that was my trade
But the king's shilling is now my fee
A butcher I may as well have stayed
For the slaughter that I see

And the preacher in his pulpit
Sermon: "Go and fight, do what is right"
But he don't have to hear these guns
And I'll bet he sleeps at night.
Home Blog About Contact
News

txt2html

Please note!

txt2html version 2 is available from GitHub: https://github.com/SanderSade/txt2html .

Version 2 offers additional functionality and various other improvevements, as well as future updates. It is recommended that you use v2 over the v1, which is no longer supported or updated.

The current page and v1 download will remain here for people who cannot use .NET v4.6-based programs (that means Windows Vista and below).

Download txt2html.zip (205.46 KB)

As you probably already guessed, txt2html is a program to convert plain text files to the hypertext markup language. Why did I create this program when there are already plenty of such programs and you can even convert text file to html using Microsoft Word??

Well, as usual, there are plenty of reasons. Firstly, many such programs are not free. Secondly, their output is (I'm sad to say, as a rule) either garbled or poor HTML. Thirdly, no option to include your own CSS. I could go on and and on, but let me point out the highlights of my txt2html:

  • Extremely clean W3C 4.01 Strict DTD compliant HTML
  • Option to include your own CSS
  • HTML entity replacement (optional; you can also edit the entity list). Note that critical entities (<,>,",&) are always replaced, so generally you don't have to enable this option!
  • Detects _italic_ and *bold* (optional)
  • Detects and marks URL's (optional)
  • Optional paragraph joining
  • Optional shell integration (item "txt2html" in right-click menu for .txt files)
  • Fast
  • Free

txt2html

 

As you can see, the interface is very simple. Two things that might need clarification are button "Remove shell shortcut" ("Create shell shortcut" if it doesn't exist) and HTML file name hyperlink.

Shell shortcut (ie menu item in Windows Explorer right-click menu) will be created for .txt files - item txt2html. When you convert files from shell shortcut, saved settings from the GUI are used. Paberclip icon will be on the system tray while txt2html is converting the file.

As for the HTML file name hyperlink, it works like a normal web link - click on it and the resulting file will be opened in your default browser. However, if you shift-click on it then Windows Explorer will open - in the folder where resulting HTML file is.

 

Size comparison

  • Original: 19 222 898 (18.3MB) .txt file, 355896 lines.
  • txt2html: 21 728 298 (20.7MB)
  • MS Word 2003 (filtered + Tidy): 21 906 065 (20.8MB)
  • MS Word 2003 (filtered): 36 980 364 (35.2MB)
  • MS Word 2003 (unfiltered): 47 236 086 (45.0MB)

 

Installing

To install, just extract all files from the archive to any folder and double-click on txt2html.exe to start using the program.

Uninstalling

Delete all files, but remember to remove shell shortcut if you created it (if then button reads "Remove shell shortcut" then you've obviously created the shell shortcut). txt2html does not write any other registry entries.

 


Acknowledgements

MollyKate fixed (or I should say re-made) the mess that I had made with the entities list. She also gave me lots of useful advice about HTML and life in general.

QuietSilence gave me the idea of joining paragraphs.


Version info

  • 1.0 Initial release
  • 1.01.Improved paragraph joining. If line ends with "'.!? program will assume that this is the end of the paragraph. There will be some additions to this feature soon.
  • 1.1.Like promised, further improvements in paragraph joining. Should be quite accurate now if minimum line length is set correctly.
'

Valid HTML 4.01 Transitional Valid CSS!