Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

correctly display indentation inside <pre> tag

Tags:

slim-lang

What is the recommended method of displaying preformatted text (especially code samples with significant whitespace) with Slim?

For example, how to display the below (with correct indentation) using Slim:

<pre>
Vivamus eu lacinia nisi
  Nam pretium urna magna
  Donec sit amet enim ac augue luctus pharetra. 
    Pellentesque dictum
      Enim vel
  Cras risus lectus
</pre>

Embedded engines are an acceptable answer, but not preferred.

like image 817
user843328 Avatar asked Apr 02 '14 23:04

user843328


1 Answers

Well, all you need to do is use the pipe:

pre
  | Vivamus eu lacinia nisi
      Nam pretium urna magna
      Donec sit amet enim ac augue luctus pharetra. 
        Pellentesque dictum
          Enim vel
      Cras risus lectus

Everything after the pipe is copied over. See the slim docs: http://rdoc.info/gems/slim/file/README.md#Text__

like image 167
three Avatar answered Sep 29 '22 09:09

three