<commit_before>htmlr
=====

Htmlr is a Domain Specific Language (DSL) in javascript for generating HTML.
It can be used on the server or in the browser.  In the browser it can generate
HTML text for use with .innerHTML or it can generate document fragements for use
with .appendChild.

Installation
------------

```bash
npm install htmlr
```

For use in the browser, include the following script tag:

```html
<script src="htmlr.js"></script>
```

Usage
-----

```javascript
with (Htmlr) {
  var template = doctype(
    html(
      head({lang: 'en'},
        meta({charset: 'utf-8'}),
        title('{title}'),
        css('style.css'),
        javascript('script.js')
      ),
      body(
        h1("Hello World!"),
        comment("woot!"),
        div({id: 'content'}, '{0}')
      )
    )
  );
}

var data = {title: "My Title", content: "My Content"};

// create server side string or for browser .innerHTML
var html = template.render(data);

// create browser side DOM
var dom = template.renderDOM(data);
```

```html
<!DOCTYPE html>
<html>
  <head lang="en">
    <meta charset="utf-8" />
    <title>My Title</title>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>
  <body>
    <h1>Hello World!</h1>
    <!--woot!-->
    <div id="content">
      My Content
    </div>
  </body>
</html>
```

Features
--------

1.  Use the `with` statement to prevent pollution of the global namespace

```javascript
with (Htmlr) {
  var template = div();
}    
var html = template.render();
```

```html
<div />
```

2.  Use an object as the first parameter to set attributes

        with (Htmlr) {
          var template = div({id: 'mydiv', class: 'awesome'});
        }    
        var html = template.render();
        // <div id="mydiv" class="awesome" />

3.  Use any other data type for the first paramter and all data types afterward<commit_msg>fixing markdown<commit_after>htmlr
=====

Htmlr is a Domain Specific Language (DSL) in javascript for generating HTML.
It can be used on the server or in the browser.  In the browser it can generate
HTML text for use with .innerHTML or it can generate document fragements for use
with .appendChild.

Installation
------------

```bash
npm install htmlr
```

For use in the browser, include the following script tag:

```html
<script src="htmlr.js"></script>
```

Usage
-----

```javascript
with (Htmlr) {
  var template = doctype(
    html(
      head({lang: 'en'},
        meta({charset: 'utf-8'}),
        title('{title}'),
        css('style.css'),
        javascript('script.js')
      ),
      body(
        h1("Hello World!"),
        comment("woot!"),
        div({id: 'content'}, '{0}')
      )
    )
  );
}

var data = {title: "My Title", content: "My Content"};

// create server side string or for browser .innerHTML
var html = template.render(data);

// create browser side DOM
var dom = template.renderDOM(data);
```

```html
<!DOCTYPE html>
<html>
  <head lang="en">
    <meta charset="utf-8" />
    <title>My Title</title>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>
  <body>
    <h1>Hello World!</h1>
    <!--woot!-->
    <div id="content">
      My Content
    </div>
  </body>
</html>
```

Features
--------

1.  Use the `with` statement to prevent pollution of the global namespace

    ```javascript
    with (Htmlr) {
      var template = div();
    }    
    var html = template.render();
    ```
    
    ```html
    <div />
    ```

2.  Use an object as the first parameter to set attributes

        with (Htmlr) {
          var template = div({id: 'mydiv', class: 'awesome'});
        }    
        var html = template.render();
        // <div id="mydiv" class="awesome" />

3.  Use any other data type for the first paramter and all data types afterward
{'fraction_non_alphanumeric': 0.16378859236002094, 'fraction_numerical': 0.004709576138147566, 'mean_word_length': 2.5595903165735567, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5334338', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1183, 'n_words': 406}