plugin-codetabs icon indicating copy to clipboard operation
plugin-codetabs copied to clipboard

unexpected token: %

Open tsundberg opened this issue 9 years ago • 0 comments

When I paste the example below into a GitBook


{% codetabs name="Python", type="py" -%}
msg = "Hello World"
print msg
{%- language name="JavaScript", type="js" -%}
var msg = "Hello World";
console.log(msg);
{%- language name="HTML", type="html" -%}
<b>Hello World</b>
{%- endcodetabs %}

And do

gitbook serve

I get this error:

Template render error: (/Users/tsu/projects/cucumber/cucumber/docs/10-minute-tutorial.md) [Line 16, Column 38]
  unexpected token: %}

And the server stops.

To resolve it, I need to use this example:

{% codetabs name="Python", type="py" %}
msg = "Hello World"
print msg
{% language name="JavaScript", type="js" %}
var msg = "Hello World";
console.log(msg);
{% language name="HTML", type="html" %}
<b>Hello World</b>
{% endcodetabs %}

The difference is the usage of -% and %-

I installed GitBook using [email protected] and is using node v6.3.0

Have I found a bug in the documentation or am I using codetabs incorrect?

tsundberg avatar Jul 17 '16 20:07 tsundberg