simple way to bold a word

4,774 views
Skip to first unread message

todd

unread,
Jan 22, 2009, 4:49:41 AM1/22/09
to Haml
Is there a simple way to bold a word in a paragraph, or add a link
inside a paragraph of text?

I can't seen to work out how...

FiXato

unread,
Jan 22, 2009, 5:38:00 AM1/22/09
to ha...@googlegroups.com
You could do:
%p
here is some
%b bold text
with
%a{:href => 'http://wheredo.you.want.to.go.today'} a link
and some more text

which would generate:
<p>
here is some
<b>bold text</b>
with
<a href='http://wheredo.you.want.to.go.today'>a link</a>
and some more text
</p>

Or just choose to not use haml for some of the inline things:
%p
here is some <b>bold</b> text with <a
href="http://wheredo.you.want.to.go.today">a link</a> and some more
text

Or you could have a look at the markup filters such as markdown or redcloth.

Or if you use haml within rails, use the rails helpers such as:
%p== here is some #{content_tag(:b, 'bold text')} with #{link_to 'a
link', 'http://wheredo.you.want.to.go.today'} and some more text.

As you can see, several options ;)

2009/1/22 todd <foxt...@gmail.com>:

Mislav Marohnić

unread,
Jan 22, 2009, 5:39:17 AM1/22/09
to ha...@googlegroups.com
The answer may surprise you!!

  %p This text <b>is in bold letters</b>. 

Same for links. If you want to dynamically generate links, you have 2 options:

  %p== This text #{link_to('is linked', home_path)}.

Or:
  
  %p
    This text
    = link_to("is linked", home_path), '.'

FiXato

unread,
Jan 22, 2009, 5:46:04 AM1/22/09
to ha...@googlegroups.com
> 2009/1/22 todd <foxt...@gmail.com>:
>>
>> Is there a simple way to bold a word in a paragraph, or add a link
>> inside a paragraph of text?
>>
>> I can't seen to work out how...

> 2009/1/22 FiXato <fix...@gmail.com>:
> You could do:
[..snip...]


> As you can see, several options ;)

They might be more readable from a pastie:
http://slexy.org/view/s20aToOsI3 which includes an extra example too.

happy haml'ing :)
-Filip

todd

unread,
Jan 23, 2009, 12:20:07 AM1/23/09
to Haml
thanks guys, appreciate the friendly helpful feedback :)


On Jan 22, 5:46 pm, FiXato <fix...@gmail.com> wrote:
> > 2009/1/22 todd <foxto...@gmail.com>:
>
> >> Is there a simple way to bold a word in a paragraph, or add a link
> >> inside a paragraph of text?
>
> >> I can't seen to work out how...
> > 2009/1/22 FiXato <fix...@gmail.com>:
> > You could do:
> [..snip...]
> > As you can see, several options ;)
>
> They might be more readable from a pastie:http://slexy.org/view/s20aToOsI3which includes an extra example too.
Reply all
Reply to author
Forward
0 new messages