【问题标题】:Insert code - Markdown. Liquid Exception插入代码 - Markdown。液体异常
【发布时间】:2015-03-28 23:39:51
【问题描述】:

我正在使用 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]

有人可以帮助我吗?

谢谢。

【问题讨论】:

    标签: markdown jekyll liquid


    【解决方案1】:

    为了避免 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 %}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-27
      • 1970-01-01
      相关资源
      最近更新 更多