Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using tags such as bold or italic in slim?

Let's say I have this code in HTML:

<p>Lorem ipsum, <b>volutpat</b>. Ut wisi enim ad minim veniam.</p>

How would I convert that to slim? Throughout all of Slim's documentation, it never once mentions bold, italic, or any other inline elements. I tried this:

p Lorem ipsum, b volutpat. Ut wisi enim ad minim veniam.

As expected it just added a 'b' to the text. I also tried using tubes:

p Lorem ipsum, 
  | b volutpat.
  | Ut wisi enim ad minim veniam.

This gave me the exact same result, plus. If anyone could help, I'd greatly appreciate it! Here is just a few trials that I was trying to work out: http://codepen.io/spikeyty/pen/wruIs

like image 296
Ty Strong Avatar asked Jan 01 '14 21:01

Ty Strong


2 Answers

It's sometimes not worth following every rule. Use this and you are fine.

p Lorem ipsum, <b>volutpat</b>. Ut wisi enim ad minim veniam.

You can also use Markdown directly in Slim if a lot of bolds and italics appear in your text, for example:

p Normal slim syntax.
markdown:
  Lorem Markdownum, **volutpat**. Ut wisi *enim* ad minim `veniam`.
like image 152
Nowaker Avatar answered Oct 08 '22 16:10

Nowaker


p
 |Lorem ipsum, 
 b volutpat. 
 |Ut wisi enim ad minim veniam.

This gets rendered as "Lorem ipsum, volutpat. Ut wisi enim ad minim veniam." (see your updated codepen).

Source: https://groups.google.com/forum/#!topic/slim-template/h8fYkG5lj9k

like image 24
nietonfir Avatar answered Oct 08 '22 16:10

nietonfir