Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while using javascript #2

Open
jcubic opened this issue Aug 27, 2017 · 1 comment
Open

Error while using javascript #2

jcubic opened this issue Aug 27, 2017 · 1 comment

Comments

@jcubic
Copy link

jcubic commented Aug 27, 2017

I have code like this:

{% highlight jsx %}
function Pagination(props, children) {
   var list = [];
   var _class;
   for (var i=0; i<props.size; i++) {
      if (i == props.selected) {
        _class = 'selected';
      } else {
        _class = '';
      }
      list.push(<li class={_class}>{i}</li>);
   }
   return (<ul>{list}</ul>);
}
{% endhighlight %}

and the output in jekyll blog post, look like this:

image

white with red have class "err".

@jcubic jcubic changed the title Error while using javascript in s Error while using javascript in jsx Aug 27, 2017
@jcubic jcubic changed the title Error while using javascript in jsx Error while using javascript Aug 27, 2017
@fcurella
Copy link
Owner

The issue is that the lexer is parsing <props.size; as a Tag. If you write it as i < prop.size; it will be parsed correctly.

That said, if that's valid JSX (ie: if your bundler parses it correctly), jsx-lexer should support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants