- Convert Plain Text to HTML
- The Plain Text to HTML Converter
- Converter on Your Page With One Line of JavaScript
- Downloadable Plain Text to HTML Converter
- Plain Text to HTML Converter function ConvertPlainTextToHTML($s) < $LineFeed = strpos($s,"\r\n")!==false ? "\r\n" : ( strpos($s,"\n")!==false ? "\n" : "\r" ); $s = trim($s); $s = strpos($s,"\n")===false ? str_replace("\r","\n",$s) : str_replace("\r",'',$s); $s = preg_replace('/\n\n+/','~~N-n~--~~N-n~-- ~~N-n~--',$s); $s = str_replace("\n","\n ",$s); $s = str_replace('~~N-n~--',"\n",$s); $s = " \n$s\n"; # Image URLs into IMG tag. $matches = array(); preg_match_all('!\b(https?://[a-zA-Z0-9\-\._\~\:/\'\+\=\%\(\)]+\.(png|jpg|jpeg|gif))!s',$s,$matches); foreach( $matches[1] as $match ) < $encoded = quotemeta($match); $s = preg_replace( '!\b'.$encoded.'!s', '', $s ); > # Non-image URLs into A tag. $matches = array(); preg_match_all('!\b(https?://[a-zA-Z0-9\-\._\~\:/\?\#\[\]\@\!\$\&\'\(\)\*\+,;\=\%]+)!s',$s,$matches); foreach( $matches[1] as $match ) < $encoded = quotemeta($match); $s = preg_replace( '!\b'.$encoded.'!s', '' . $match . '', $s ); > # Image URLs from h__HH__hhttp:// to http:// and from h__HH__hhttps:// to https:// $s = str_replace('h__HH__hhttp','http',$s); return str_replace("\n",$LineFeed,$s); > ?> The converted text is in this box ready to copy and paste. Another? Paste or type plain text into this box, then click the button to convert to HTML. Complimentary from Will Bontrager Software LLC
- TXT to HTML Converter
- convert to
- compress
- capture website as
- create archive
- extract
- Options
- TXT
- HTML
- +200 Formats Supported
- Data Security
- High-Quality Conversions
- Powerful API
- Text To HTML Converter
- How to Use the Tool ?
- Tool’s Features
Convert Plain Text to HTML
Many apps and software that let you type in text for publishing on web pages automatically convert what you type into HTML.
HTML tags p and br are the most common HTML tags inserted during the conversion. Some also create img tags from image URLs found in the plain text. And create clickable links from URLs.
There are, however, apps and software that require you to provide your own HTML markup.
It can be time consuming or even a challenge to take plain text and edit it to display in a browser with valid HTML.
This morning, while casting about for an article topic, I found out I’ve been remiss: No plain text to HTML converter was anywhere on the willmaster.com website.
Oh, there are a lot of converters, over two dozen as a matter of fact. See the generators and converters index page. But no plain text to HTML converter.
Today that is rectified. The plain text to HTML converter has been created. Use it in any of three locations.
- The software can be used on this page (further below in this article) to convert your plain text into HTML. Paste or type in your text and click the button.
- The form and conversion functionality can be installed on your web page with one line of JavaScript. It works on WordPress and on non-WordPress pages.
- The PHP plain text to HTML conversion software can be downloaded and installed on your domain.
The Plain Text to HTML Converter
Here is the converter. Use it right here in this article.
The software currently inserts p and br HTML tags.
Click a button to convert plain text into valid HTML code.
Wherever one or more blank lines occur, the p tag is used. Hard returns without a blank line get br tags.
Updates planned for the near future include:
- DONE (version 1.1)
Make img tags from absolute http://. image URLs — image URLs being defined as file names ending with .gif, .jpg, .jpeg, and .png. - DONE (version 1.1)
Make clickable links from absolute http://. non-image URLs. - Convert one-paragraph lists to ordered or unordered lists.
- Provide choice of HTML or XHTML coding.
- Provide choice where to put the tag (beginning of line, ending of line, within line).
The updates will automatically be applied to
- the converter on this page and
- the converter you get when you install the form and conversion functionality on your web page with the single line of JavaScript.
The downloadable software will need to be re-downloaded and re-installed for updates.
Converter on Your Page With One Line of JavaScript
The form and conversion functionality can be installed on your web page with this line of JavaScript.
Paste the JavaScript into your page and you’re good to go. If you publish with WordPress, use the «Text» tab, not the «Visual» tab at your post/page editing interface.
It will work like the converter further above on this page because it’s pulled into the article by that same JavaScript. Depending on your CSS, the design on your page may be different.
Downloadable Plain Text to HTML Converter
The download is a complete web page.
The web page can be downloaded and saved to your hard drive or the source code can be copied from this box and pasted into your own file. No customization is required, but may be desired. Notes follow the source code.
body < font-size:100%; >a < text-decoration:none; >#content < max-width:6in; margin:.5in auto; >.box-style