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

有帮助吗?

解决方案

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`.

其他提示

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

Those tags are considered deprecated, please consider using their newer versions.

<b> has been replaced with <strong>

<i> has been replaced with <em>

It shoud be something like

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

codepen

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top