foundation / panini

A super simple flat file generator.
Other
592 stars 104 forks source link

[question] Multi-line code blocks within {{#code}} helper #110

Open renatodeleao opened 7 years ago

renatodeleao commented 7 years ago

Trying to use the {{#code}} helper for a documentation page which has several multi-line code blocks. Syntax highlighting works as expected good but Indentation gets messed up.

This

<section>
   <div class="presenatitionalClass">
      <div class="anotherPresentationaClass">
         {{#code "JSON"}}
         {
           "key": 2;
           "key2": "value";
         }
         {{/code}}
     </div>
   </div>
</section>

Renders this: image

Putting the whole block unindented

<section>
   <div class="block">
      <div class="anotherpresentational">
{{#code "JSON"}}
{
  "key": 2;
  "key2": "value";
}
{{/code}}
     </div>
   </div>
</section>

Only removes first line whitespace otherimage

Any suggestion/help on how to workaround this or if i'm doing something wrong with the content? Thanks.

gakimball commented 7 years ago

The code helper should strip indent for sure.

As for the un-indented example, not sure what's happening there.

We'll look into both!

Deckluhm commented 7 years ago

Is that valid to have ; to separate JSON elements? (I'm pretty sure that the answer is "no")

gakimball commented 7 years ago

No, semicolons aren't valid anywhere in JSON, just commas.