1.0.10 • Published 2 years ago

wrihtml v1.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

wrihtml

Example

  1. Element with class

    var wrihtml = require('wrihtml');
    var html = wrihtml(
        `div [text-center bg-danger] This is a div`
    )

    Output: This is a div

    <div class="text-center bg-danger">This is a div</div>
  2. Element with attributes

    var html = wrihtml(
    `button [class="btn btn-danger" onclick="alert('alert!')"] a button`
    )

    Output: a button

    <button class="btn btn-danger" onclick="alert('alert!')">a button</button>
  3. with child element

    var html = wrihtml(
     `div/ [col-12 col-md-6]
     h1  title 1
     h2  title 2
     /div`
     )

    Output

    <div class="col-12 col-md-6">
        <h1>title 1</h1>
        <h2>title 2</h2>
    </div>
  4. with multiple line inner text

     var html = wrihtml(
     `h1/ [text-dark]
     // first line text in h1,
     // 2nd line text in h1
     /h1`)

    Output

  5. Ignore line started with '<'

     var html = wrihtml(
     `h1 [text-dark] h1 text
     <h2>h2 text</h2>
     h3 h3 text
     `)

    Output

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago