Skip to content

Commit

Permalink
Merge pull request hanami#145 from davydovanton/html-link-to
Browse files Browse the repository at this point in the history
Add information about supporting link_to method
  • Loading branch information
jodosha committed Feb 9, 2016
2 parents 491fa4f + d59797b commit f590d80
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions source/guides/helpers/html5.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,31 @@ html.tag(:custom, 'Foo', id: 'next') # => <custom id="next">Foo</custom>
html.empty_tag(:xr, id: 'next') # => <xr id="next">
```

## Other helpers

Hanami html helpers also support other assembled helpers. For example `link_to` helper:

```ruby
html.div do
link_to 'hello', routes.root_path, class: 'btn'
end
# => <div>
# => <a href="/" class="btn">hello</a>
# => </div>

html.div do
link_to 'Users', routes.users_path, class: 'btn'
hr
link_to 'Books', routes.books_path, class: 'btn'
end

# => <div>
# => <a href="/users" class="btn">Users</a>
# => </hr>
# => <a href="/posts" class="btn">Books</a>
# => </div>
```

## Auto escape

The tag contents are automatically escaped for **security** reasons:
Expand Down

0 comments on commit f590d80

Please sign in to comment.