diff options
| author | Yehonal <yehonal.azeroth@gmail.com> | 2020-05-13 21:14:56 +0200 |
|---|---|---|
| committer | Yehonal <yehonal.azeroth@gmail.com> | 2020-05-13 21:14:56 +0200 |
| commit | 2df1263a2a994315a0c752feb27640dcc45234c2 (patch) | |
| tree | 563aee674f2ce310f51fe23d4588d3be1614c654 /_includes/git-wiki/components/toc/toc-lib.html | |
| parent | 7048c66f61258b0110158bc8868a8e198f1a2a7c (diff) | |
| download | wiki-2df1263a2a994315a0c752feb27640dcc45234c2.tar.gz wiki-2df1263a2a994315a0c752feb27640dcc45234c2.tar.bz2 wiki-2df1263a2a994315a0c752feb27640dcc45234c2.zip | |
using remote theme
Diffstat (limited to '_includes/git-wiki/components/toc/toc-lib.html')
| -rw-r--r-- | _includes/git-wiki/components/toc/toc-lib.html | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/_includes/git-wiki/components/toc/toc-lib.html b/_includes/git-wiki/components/toc/toc-lib.html deleted file mode 100644 index 8851400..0000000 --- a/_includes/git-wiki/components/toc/toc-lib.html +++ /dev/null @@ -1,109 +0,0 @@ -{% capture tocWorkspace %} - {% comment %} - Version 1.0.9 - https://github.com/allejo/jekyll-toc - - "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe - - Usage: - {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} - - Parameters: - * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll - - Optional Parameters: - * title (string) : Contents: - title for the TOC - * minHeaders (int) : 1 - minimum number of headers required to show the TOC - * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC - * class (string) : '' - a CSS class assigned to the TOC - * id (string) : '' - an ID to assigned to the TOC - * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored - * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored - * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list - * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level - * baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content - * anchor_class (string) : '' - add custom class(es) for each anchor element - - Output: - An ordered or unordered list representing the table of contents of a markdown block. This snippet will only - generate the table of contents and will NOT output the markdown given to it - {% endcomment %} - - {% capture my_toc %}{% endcapture %} - {% assign title = include.title | default: "Contents:" %} - {% assign minHeaders = include.minHeaders | default: 1 %} - {% assign orderedList = include.ordered | default: false %} - {% assign minHeader = include.h_min | default: 1 %} - {% assign maxHeader = include.h_max | default: 6 %} - {% assign nodes = include.html | split: '<h' %} - {% assign firstHeader = true %} - - {% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %} - - {% assign hCount = 0 %} - - {% for node in nodes %} - {% if node == "" %} - {% continue %} - {% endif %} - - {% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %} - - {% if headerLevel < minHeader or headerLevel > maxHeader %} - {% continue %} - {% endif %} - - {% if firstHeader %} - {% assign firstHeader = false %} - {% assign minHeader = headerLevel %} - {% endif %} - - {% assign indentAmount = headerLevel | minus: minHeader %} - {% assign _workspace = node | split: '</h' %} - - {% assign _idWorkspace = _workspace[0] | split: 'id="' %} - {% assign _idWorkspace = _idWorkspace[1] | split: '"' %} - {% assign html_id = _idWorkspace[0] %} - - {% assign _classWorkspace = _workspace[0] | split: 'class="' %} - {% assign _classWorkspace = _classWorkspace[1] | split: '"' %} - {% assign html_class = _classWorkspace[0] %} - - {% if html_class contains "no_toc" %} - {% continue %} - {% endif %} - - {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %} - {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} - - {% assign space = '' %} - {% for i in (1..indentAmount) %} - {% assign space = space | prepend: ' ' %} - {% endfor %} - - {% if include.item_class and include.item_class != blank %} - {% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %} - {% endif %} - - {% assign hCount = hCount | plus: 1 %} - - {% capture heading_body %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %} - {% capture my_toc %}{{ my_toc }} -{{ space }}{{ listModifier }} {{ listItemClass }} [{{ heading_body | replace: "|", "\|" }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %} - {% endfor %} - - {% if include.class and include.item_class != blank %} - {% capture my_toc %}{:.{{ include.class }}} -{{ my_toc | lstrip }}{% endcapture %} - {% endif %} - - {% if include.id %} - {% capture my_toc %}{: #{{ include.id }}} -{{ my_toc | lstrip }}{% endcapture %} - {% endif %} -{% endcapture %}{% assign tocWorkspace = '' %} - -{% if hCount >= minHeaders %} - {{ title }} - {{ my_toc | markdownify | strip }} -{% endif %}
\ No newline at end of file |
