EightMedia / styleguide.js

Generate a styleguide from your CSS, by adding YAML data
193 stars 8 forks source link

input tags are treated as if they need closed. --> incorrect code formatting in source preview #17

Closed rtack closed 8 years ago

rtack commented 8 years ago
    <div class="checkbox">
      <label>
        <input type="checkbox" value="" checked>
        Checked
      </label>
    </div>

get's rendered as

<div class="checkbox">
    <label>
        <input type="checkbox" value=""> Checked </label>
</div>

in the toggle source

msisto commented 8 years ago

+1

Aratramba commented 8 years ago

this can be fixed like this:

  1. Make sure you use yaml literal style when declaring your example:
/***
  title: Input
  section: forms
  example: |
    <div class="checkbox">
      <label>
        <input type="checkbox" value="" checked>
        Checked
      </label>
    </div>
***/
  1. Add the beautifyHtml: preserve_newlines option
var sg = new StyleGuide();
sg.addFile("file.css");
sg.render({ 
  outputFile: 'file.html',
  beautifyHtml: {
    preserve_newlines: true
  }
}, function() {});

Does this fix it for you?