README.md

# DslHtml

DSL for HTML in Elixir.

**NOTE**

This code is based from the sample code in below book:

> https://pragprog.com/book/cmelixir/metaprogramming-elixir

If you want to find more, check it out.

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed as:

  1. Add `dsl_html` to your list of dependencies in `mix.exs`:

    ```elixir
    def deps do
      [{:dsl_html, "~> 0.1.0"}]
    end
    ```

  2. Ensure `dsl_html` is started before your application:

    ```elixir
    def application do
      [applications: [:dsl_html]]
    end
    ```

## Usage

```elixir
defmodule Template do
  import Html

  def render do
    markup do
      div id: "main" do
        h1 class: "title" do
          text "Welcome!"
        end
      end
      div class: "row" do
        div do
          p do: text "Hello!"
        end
      end
      table do
        tr do
          for i <- 0..5 do
            td do: text("Cell #{i}")
          end
        end
      end
      div do
        text "Some Nested Content"
      end
    end
  end
end
```