Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Jan 30, 2024
1 parent 2307bdd commit 4a9b5a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ end
render Greeting
```

Underscores `_` are automatically converted to dashes `-` for `Symbol` keys. If you need to use an underscore in an attribute name, you can pass it as a `String`.
Underscores `_` are automatically converted to dashes `-` for `Symbol` keys. If you need to use an underscore in an attribute name, you can use a `String` key instead.

```phlex
class Greeting < Phlex::HTML
def template
h1(foo_bar: "hello") { "👋 Hello World!" }
h1("foo_bar" => "hello") { "👋 Hello World!" }
end
end
Expand All @@ -208,7 +209,7 @@ render Greeting
```

### Hash attributes
You can pass a `Hash` as an attribute value and the Hash will be flattened with a dash between each level.
You can pass a `Hash` as an attribute value and it will be flattened with a dash `-` between each level.

```phlex
class Greeting < Phlex::HTML
Expand Down

0 comments on commit 4a9b5a6

Please sign in to comment.