插入代码-Markdown.液体例外



我正在使用jekyll 2.5.3写博客。我试着这么做:

{% highlight javascript %}
class RandomQuotes extends React.Component {
  render() {
    return (
      <React.NavigatorIOS
        style={styles.container}
        initialRoute={{
          title: 'Random Quotes',
          component: titleApp
        }}/>
    );
  }
}   
{% endhighlight %} 

但是因为这个部分initialRoute={{…}}我得到这个错误

Liquid Exception: Variable '{{' was not properly terminated with regexp: /}}/ in... [my markdown file]

有人能帮我吗?

谢谢。

为了避免Liquid变量或标签解析,您可以使用{%raw%}标签:

{% highlight javascript %}
class RandomQuotes extends React.Component {
  render() {
    return (
      <React.NavigatorIOS
        style={styles.container}
        initialRoute={% raw %}{{
          title: 'Random Quotes',
          component: titleApp
        }}{% endraw %}/>
    );
  }
}
{% endhighlight %}

最新更新