2016-10-16 1 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이 데이터에 액세스하고 있습니다. markdown은 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> 
    ```