How do I keep whitespace formatting using PHP/HTML?
use the <pre> tag (pre formatted), that will use a mono spaced font (for your art) and keep all the white space
<pre>
text goes here and here
and here and here Some out here
▄ ▄█▄ █▄ ▄
▄█▀█▓ ▄▓▀▀█▀ ▀▀▀█▓▀▀ ▀▀ ▄█▀█▓▀▀▀▀▀▓▄▀██▀▀
██ ██ ▀██▄▄ ▄█ ▀ ░▒ ░▒ ██ ██ ▄█▄ █▀ ██
█▓▄▀██ ▄ ▀█▌▓█ ▒▓ ▒▓ █▓▄▀██ ▓█ ▀▄ █▓
█▒ █▓ ██▄▓▀ ▀█▄▄█▄▓█ ▓█ █▒ █▓ ▒█ ▓█▄ ▒
▀▒ ▀ ▀ █▀ ▀▒ ▀ █▀ ░
</pre>
You might have to convert any <'s to < 's
Convert text formatted with whitespace to html
What you're looking for is a Markdown to HTML converter. Magmi doesn't have a plugin that can do this, however you could easily write one yourself.
- Create a Magmi plugin folder and file.
- Include a Markdown to HTML PHP library, such as this: https://github.com/michelf/php-markdown
Use the
processItemBeforeId()
function to update the descriptions on the fly in the plugin, like this:public function processItemBeforeId(&$item,$params=null)
{
//Use the Markdown class library to convert the description.
$updated_description = Markdown::defaultTransform($item['description']);
//Update the description of the item before it gets imported.
$item['description'] = $updated_description;
}- Enable your custom Magmi plugin, and it should start converting the descriptions on the fly when you import.
White-space formatting concerns in HTML
Wrap in a <pre>
tag then apply some css: How do I wrap text in a pre tag?
pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
Demo with your sample html: http://jsfiddle.net/B98jc/
Related Topics
Pdo Were Rows Affected During Execute Statement
Differencebetween Switch-Case and If-Else in PHP
Multiple Http Get Parameters with the Same Identifier
What Does Bind_Param Accomplish
Could Not Connect to Smtp Host
Token Was Deauthenticated After Trying to Refresh It
PHP Reflection - Get Method Parameter Type as String
How to Increment Count in the Replacement String When Using Preg_Replace
How to Run the Bind_Param() Statement in PHP
Checking Browser's Language by PHP
Why Does File_Get_Contents Work with Google.Com But Not with My Site