2016-10-16 10 views
0

私は、マークダウンされた構文が強調表示された項目のリストを示すジキールページで作業中です。コードです。私はこのデータ変数を使用したジキールの構文の強調表示

# myitems.yaml 
id: 'someID' 
updated: 'someDate' 

items: 
    - item: 
    id: "0001" 
    content: " 
*This is italicized*, and so is _this_. 
**This is bold**, and so is __this__. & 
Use ***italics and bold together*** if you ___have to___. 
``` html 
<script>alert() some content</script> 
<p>paragraph</p> 
```" 
    - item: 
    id: "0002" 
    content: "some more content" 

のような内容でデータファイルをしましたので、items[].contentは値下げ+構文が強調表示されるためにいくつかのコードを持っています。

私は口紅の構文の強調表示を使用してい

<ul> 
{% for item in site.data.myitems.items %} 
    <li id="{{item.id}}"> 
     <div>{{ item.content | strip | markdownify}}</div> 
    </li> 
{% endfor %} 
</ul> 

のような液体と私のitems.htmlにこのデータにアクセスしています。マークダウンはhtmlに正しく解析されますが、html構文の強調表示はitems.html部分では機能しません。すべてのヘルプをしてくださいoutput image

<em>This is italicized</em>, and so is <em>this</em>. <strong>This is bold</strong>, and so is <strong>this</strong>. &amp; Use <strong><em>italics and bold together</em></strong> if you <strong><em>have to</em></strong>. <code class="highlighter-rouge">html &lt;script&gt;alert() some content&lt;/script&gt; &lt;p&gt;paragraph&lt;/p&gt;</code> 

:シンタックスハイライトは、ポスト体内で正常に動作しますが、{% include items.html %}

に私が手items出力されませんか?

答えて

1

通常の文字列引用符ではなくパイプを使用して解決します。

-item: 
    id:"0001" 
    content: | 
    *This is italicized*, and so is _this_. 
    **This is bold**, and so is __this__. & 
    Use ***italics and bold together*** if you ___have to___. 
    ``` html 
    <script>alert() some content</script> 
    <p>paragraph</p> 
    ``` 
関連する問題