فهرست منبع

Parse Markdown in TOC items

Daniel Rudolf 9 سال پیش
والد
کامیت
bbaa151bb3
2فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 2 2
      _includes/tocItem.html
  2. 2 2
      _includes/tocSubItems.html

+ 2 - 2
_includes/tocItem.html

@@ -1,13 +1,13 @@
 {% for item in toc %}
 {% for item in toc %}
     <li>
     <li>
         {% if item[1]._title %}
         {% if item[1]._title %}
-            <a href="#{{ item[0] }}">{{ item[1]._title }}</a>
+            <a href="#{{ item[0] }}">{{ item[1]._title | markdownify | remove: '<p>' | remove: '</p>' }}</a>
             <ul>
             <ul>
                 {% assign subItems = item[1] %}
                 {% assign subItems = item[1] %}
                 {% include tocSubItems.html %}
                 {% include tocSubItems.html %}
             </ul>
             </ul>
         {% else %}
         {% else %}
-            <a href="#{{ item[0] }}">{{ item[1] }}</a>
+            <a href="#{{ item[0] }}">{{ item[1] | markdownify | remove: '<p>' | remove: '</p>' }}</a>
         {% endif %}
         {% endif %}
     </li>
     </li>
 {% endfor %}
 {% endfor %}

+ 2 - 2
_includes/tocSubItems.html

@@ -2,13 +2,13 @@
     {% if subItem[0] != "_title" %}
     {% if subItem[0] != "_title" %}
         <li>
         <li>
             {% if subItem[1]._title %}
             {% if subItem[1]._title %}
-                <a href="#{{ subItem[0] }}">{{ subItem[1]._title }}</a>
+                <a href="#{{ subItem[0] }}">{{ subItem[1]._title | markdownify | remove: '<p>' | remove: '</p>' }}</a>
                 <ul>
                 <ul>
                     {% assign subItems = subItem[1] %}
                     {% assign subItems = subItem[1] %}
                     {% include tocSubItems.html %}
                     {% include tocSubItems.html %}
                 </ul>
                 </ul>
             {% else %}
             {% else %}
-                <a href="#{{ subItem[0] }}">{{ subItem[1] }}</a>
+                <a href="#{{ subItem[0] }}">{{ subItem[1] | markdownify | remove: '<p>' | remove: '</p>' }}</a>
             {% endif %}
             {% endif %}
         </li>
         </li>
     {% endif %}
     {% endif %}