You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

toc.html 2.2 kB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {% include vars.html %}
  2. {% assign shouldRender = false %}
  3. {% if jekyll.environment == "development" %}
  4. {% assign shouldRender = true %}
  5. {% endif %}
  6. {% if include.forceRender %}
  7. {% assign shouldRender = true %}
  8. {% endif %}
  9. {% if shouldRender and vars_active_language.tag == 'en' %}
  10. {% assign lines = include.content | newline_to_br | strip_newlines | split: '<br />' %}
  11. {% assign insideCodeBlock = false %}
  12. {% for line in lines %}
  13. {% assign threeChar = line | slice: 0, 3 %}
  14. {% assign firstChar = line | slice: 0, 1 %}
  15. {% if threeChar == '```' %}
  16. {% if insideCodeBlock %}
  17. {% assign insideCodeBlock = false %}
  18. {% else %}
  19. {% assign insideCodeBlock = true %}
  20. {% endif %}
  21. {% endif %}
  22. {% unless insideCodeBlock %}
  23. {% if firstChar == '#' %}
  24. {% assign stripped = line | strip_html %}
  25. {% assign slug = stripped | slugify | prepend: 'toc-' %}
  26. {% assign link = '<a class="toc" id="' | append: slug | append: '" href="#' | append: slug | append: '"></a>' %}
  27. {% assign full = stripped | append: ' ' | append: link %}
  28. {% unless line contains link %}
  29. <div class="alert alert-danger">
  30. <h4>Yarn Website Internal Developer Warning!</h4>
  31. <p>This page contains this heading:</p>
  32. <pre><code>{{line | escape}}</code></pre>
  33. <p>
  34. All headings need a table of contents "toc" link, you have either
  35. left it out or are using the "wrong" one. Please use this one:
  36. </p>
  37. <pre><code>{{link | escape}}</code></pre>
  38. <p>
  39. Even if this is not your fault, please correct the error. Also
  40. if there is an existing toc, please check that any links on the
  41. website to this heading are correct (just search for the previous
  42. toc id).
  43. </p>
  44. <p>
  45. If you believe you are seeing this warning by mistake, please open
  46. an issue.
  47. </p>
  48. </div>
  49. {% endunless %}
  50. {% endif %}
  51. {% endunless %}
  52. {% endfor %}
  53. {% endif %}

js yarn包管理组件依赖分析

Contributors (1)