jekyll-rtd-theme 1.1.1 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 195022eba0c5f3fcb99d247278f0fa8da67c554ba16829f1475d6b6bcc5ca482
4
- data.tar.gz: 8c2081bea527becb525f1e0ec86959942e179ff49ea4ef63bbcf151e59460c88
3
+ metadata.gz: e623e1c2a34e05c520de194e2893323851d344c01638700815240352903369f2
4
+ data.tar.gz: e5a5b57710023f64e0767f9e347fbbfe9b39b192975ec4f33293863f9ec6783f
5
5
  SHA512:
6
- metadata.gz: 539cf3a199ff035b039598609d880cd07dd6834f1c653e56f4bf4061a2989232d7b43719f35fe843ab2a0b11e6da6d7da53646b2fe81610d68ba17ce7160f3dd
7
- data.tar.gz: d51f6474b9f776573eb16e2a599862b6fbb890a97c2c7ac8c5e62737861f3139162828246e052f899a801b063550eca190ec6e6cabeae48b526dafb0d690b248
6
+ metadata.gz: ceed9ba1e1c855a4a38dc5a6a8c78dcdf81922969fd09a450c83443c228f62cf56b2198d516b6452d12c3f1018f2e65e3dc636756f0f8c859e2346b6859eed24
7
+ data.tar.gz: 4fb3d3b40f6588d790326d43b187ddf61b275e96600543aaef84521eeb0cfc0063af8a714771cfbb289fa3396862c4bf4400a2efaf8b8d0c0f81e9036e917543
data/README.md CHANGED
@@ -5,31 +5,35 @@
5
5
  [![](https://data.jsdelivr.com/v1/package/gh/rundocs/jekyll-rtd-theme/badge)][cdn]
6
6
  [![](https://www.codefactor.io/repository/github/rundocs/jekyll-rtd-theme/badge)][codefactor]
7
7
  [![](https://img.shields.io/badge/featured%20on-JekyllThemes-red.svg)](https://jekyll-themes.com)
8
+ [![](https://badges.gitter.im/rundocs/jekyll-rtd-theme.svg)][gitter]
8
9
 
9
- Just another documentation theme compatible with GitHub Pages, based on sphinx_rtd_theme
10
+ GitHub-flavored docs theme for Jekyll, based on sphinx_rtd_theme
10
11
 
11
- ![](https://user-images.githubusercontent.com/68011645/89026666-ad3a8680-d35b-11ea-9f4b-d3fe26ae12ed.png)
12
+ <img class="shadow-box" width="50%" alt="jekyll-rtd-theme" src="https://user-images.githubusercontent.com/68011645/89026666-ad3a8680-d35b-11ea-9f4b-d3fe26ae12ed.png">
13
+
14
+ ## Quick start
15
+ ```yml
16
+ remote_theme: rundocs/jekyll-rtd-theme
17
+ ```
18
+ You can [generate](https://github.com/rundocs/starter-slim/generate) with the same files and folders from [rundocs/starter-slim](https://github.com/rundocs/starter-slim/)
12
19
 
13
20
  ## Features
14
- - Automatically generate sidebar based on directory
15
- - Only need one file `_config.yml` to configure site
16
- - Search engine optimized
21
+ - Automatically generate nested sidebar based on directory
17
22
  - Multi-language supported
23
+ - Search engine optimized
18
24
  - Document search (RegExp supported)
19
25
  - Support third-party comments
20
26
  - Google, Baidu, CNZZ Analytics supported
21
-
22
- ## Roadmap
23
- See the [open issues](https://github.com/rundocs/jekyll-rtd-theme/issues) for a list of proposed features (and known issues)
27
+ - Just need one file `_config.yml` to configure site
24
28
 
25
29
  ## Documents
26
- You can view theme related [tests](https://rundocs.github.io/jekyll-rtd-theme), For full documentation, please refer to [https://rundocs.io](https://rundocs.io)
30
+ For full documentation, please refer to [rundocs.io](https://rundocs.io/), You can also view [the theme related tests documentation](https://rundocs.github.io/jekyll-rtd-theme)
27
31
 
28
- ## The License
32
+ ## License
29
33
  The theme is available as open source under the terms of the [MIT License](https://github.com/rundocs/jekyll-rtd-theme/blob/master/LICENSE).
30
34
 
31
-
32
35
  [repository]: https://github.com/rundocs/jekyll-rtd-theme
33
36
  [rubygem]: https://rubygems.org/gems/jekyll-rtd-theme
34
37
  [cdn]: https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme/
35
38
  [codefactor]: https://www.codefactor.io/repository/github/rundocs/jekyll-rtd-theme
39
+ [gitter]: https://gitter.im/rundocs/jekyll-rtd-theme?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
@@ -6,3 +6,13 @@
6
6
  </a>
7
7
  </dd>
8
8
  </dl>
9
+
10
+ <script>
11
+ $(document).ready(function() {
12
+ let analytics = new URL("https://rundocs-analytics.glitch.me/collect?v={{ version }}&lang={{ lang }}");
13
+ analytics.searchParams.append("user_lang", navigator.language);
14
+ analytics.searchParams.append("host", location.host);
15
+ analytics.searchParams.append("platform", navigator.platform);
16
+ $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count));
17
+ });
18
+ </script>
@@ -1,9 +1,6 @@
1
1
  $(document).ready(function() {
2
- let analytics = new URL("https://rundocs-analytics.glitch.me/collect?v={{ version }}&lang={{ lang }}");
3
- let highlight = new URL(location.href).searchParams.get("highlight");
4
-
5
- SphinxRtdTheme.Navigation.reset = function() {
6
- const link = $(".wy-menu-vertical").find(`[href="${location.pathname}"]`);
2
+ function initialize(name) {
3
+ let link = $(".wy-menu-vertical").find(`[href="${decodeURI(name)}"]`);
7
4
  if (link.length > 0) {
8
5
  $(".wy-menu-vertical .current").removeClass("current");
9
6
  link.addClass("current");
@@ -14,34 +11,161 @@ $(document).ready(function() {
14
11
  link.closest("li.toctree-l4").addClass("current");
15
12
  link.closest("li.toctree-l5").addClass("current");
16
13
  }
17
- };
18
- SphinxRtdTheme.Navigation.enable(true);
19
-
20
- if (highlight) {
21
- $(".section").find("*").each(function() {
22
- try {
23
- if (this.outerHTML.match(new RegExp(highlight, "im"))) {
24
- $(this).addClass("highlighted-box");
14
+ }
15
+
16
+ function toggleCurrent(link) {
17
+ let closest = link.closest("li");
18
+ closest.siblings("li.current").removeClass("current");
19
+ closest.siblings().find("li.current").removeClass("current");
20
+ closest.find("> ul li.current").removeClass("current");
21
+ closest.toggleClass("current");
22
+ }
23
+
24
+ function toc() {
25
+ $(".wy-menu-vertical li.current").append('<ul class="content-toc"></ul>').html(function() {
26
+ let level = parseInt(this.dataset.level);
27
+ let temp = 0;
28
+ let stack = [$(this).find(".content-toc")];
29
+
30
+ $(".document").find("h2,h3,h4,h5,h6").each(function() {
31
+ let anchor = $("<a/>").addClass("reference internal").text($(this).text()).attr("href", `#${this.id}`);
32
+ let tagLevel = parseInt(this.tagName.slice(1)) - 1;
33
+
34
+ if (tagLevel > temp) {
35
+ let parent = stack[0].children("li:last")[0];
36
+ if (parent) {
37
+ stack.unshift($("<ul/>").appendTo(parent));
38
+ }
39
+ } else {
40
+ stack.splice(0, Math.min(temp - tagLevel, Math.max(stack.length - 1, 0)));
25
41
  }
26
- } catch (e) {
27
- feedback(["highlight", e.message]);
42
+ temp = tagLevel;
43
+
44
+ $("<li/>").addClass(`toctree-l${level + tagLevel}`).append(anchor).appendTo(stack[0]);
45
+ });
46
+ if (!stack[0].html()) {
47
+ stack[0].remove();
28
48
  }
29
49
  });
30
- $(".section").find(".highlighted-box").each(function() {
31
- if (($(this).find(".highlighted-box").length > 0)) {
32
- $(this).removeClass("highlighted-box");
50
+ }
51
+
52
+ function set(name, value) {
53
+ return localStorage.setItem(name, value);
54
+ }
55
+
56
+ function get(name) {
57
+ return localStorage.getItem(name) || false;
58
+ }
59
+
60
+ function restore() {
61
+ let scroll = get("scroll");
62
+ let scrollTime = get("scrollTime");
63
+ let scrollHost = get("scrollHost");
64
+
65
+ if (scroll && scrollTime && scrollHost) {
66
+ if (scrollHost == location.host && (Date.now() - scrollTime < 6e5)) {
67
+ $(".wy-side-scroll").scrollTop(scroll);
33
68
  }
69
+ }
70
+ $(".wy-side-scroll").scroll(function() {
71
+ set("scroll", this.scrollTop);
72
+ set("scrollTime", Date.now());
73
+ set("scrollHost", location.host);
34
74
  });
35
75
  }
36
- for (let item in ui.admonition) {
37
- $(`.language-${item}`).each(function() {
38
- $(this).replaceWith(`<div class="admonition ${item}"><p class="admonition-title">${ui.admonition[item]}</p><p>${$(this).html()}</p></div>`);
39
- });
76
+
77
+ function highlight() {
78
+ let text = new URL(location.href).searchParams.get("highlight");
79
+ let box = ".highlighted-box";
80
+
81
+ if (text) {
82
+ $(".section").find("*").each(function() {
83
+ try {
84
+ if (this.outerHTML.match(new RegExp(text, "im"))) {
85
+ $(this).addClass("highlighted-box");
86
+ }
87
+ } catch (e) {
88
+ debug(e.message);
89
+ }
90
+ });
91
+ $(".section").find(box).each(function() {
92
+ if (($(this).find(box).length > 0)) {
93
+ $(this).removeClass(box);
94
+ }
95
+ });
96
+ }
40
97
  }
98
+
41
99
  anchors.add();
100
+ toc();
101
+ initialize(location.pathname);
102
+ restore();
103
+ highlight();
104
+
105
+ /* nested ul */
106
+ $(".wy-menu-vertical ul").siblings("a").each(function() {
107
+ let link = $(this);
108
+ let expand = $('<span class="toctree-expand"></span>');
109
+
110
+ expand.on("click", function(e) {
111
+ e.stopPropagation();
112
+ toggleCurrent(link);
113
+ return false;
114
+ });
115
+ link.prepend(expand);
116
+ });
117
+
118
+ /* admonition */
119
+ $(".admonition-title").each(function() {
120
+ $(this).html(ui.admonition[$(this).attr("ui")]);
121
+ });
122
+
123
+ /* bind */
124
+ $(document).on("click", '[data-toggle="wy-nav-top"]', function() {
125
+ $('[data-toggle="wy-nav-shift"]').toggleClass("shift");
126
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
127
+ });
128
+ $(document).on("click", ".wy-menu-vertical .current ul li a", function() {
129
+ $('[data-toggle="wy-nav-shift"]').removeClass("shift");
130
+ $('[data-toggle="rst-versions"]').toggleClass("shift");
131
+ toggleCurrent($(this));
132
+
133
+ $("html,body").animate({
134
+ scrollTop: $(this.hash).offset().top
135
+ }, 500);
136
+ });
137
+ $(document).on("scroll", function() {
138
+ let start = $(this).scrollTop() + ($(window).height() * 0.382);
139
+ let items = [];
42
140
 
43
- analytics.searchParams.append("user_lang", navigator.language);
44
- analytics.searchParams.append("host", location.host);
45
- analytics.searchParams.append("platform", navigator.platform);
46
- $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count));
141
+ $(".document").find("h1,h2,h3,h4,h5,h6").each(function() {
142
+ items.push({
143
+ offset: $(this).offset().top,
144
+ id: this.id,
145
+ level: parseInt(this.tagName.slice(1))
146
+ });
147
+ });
148
+ for (let i = 0; i < items.length; i++) {
149
+ if (start > items[i].offset) {
150
+ if (i < items.length - 1) {
151
+ if (start < items[i + 1].offset) {
152
+ if (items[i].level == 1) {
153
+ initialize(location.pathname);
154
+ } else {
155
+ initialize("#" + items[i].id);
156
+ }
157
+ }
158
+ } else {
159
+ initialize("#" + items[i].id);
160
+ }
161
+ }
162
+ }
163
+ });
164
+ $(document).on("click", '[data-toggle="rst-current-version"]', function() {
165
+ $('[data-toggle="rst-versions"]').toggleClass("shift-up");
166
+ });
167
+ $(window).bind("resize", function() {
168
+ requestAnimationFrame(function() {});
169
+ });
170
+ $(window).bind("hashchange", (e) => initialize(location.hash || location.pathname));
47
171
  });
@@ -13,7 +13,7 @@ function search(data) {
13
13
  $(".search").empty();
14
14
  $(".search-summary").html(i18n[lang].search_results_not_found);
15
15
  $("#search-results h2").html(i18n[lang].search_results);
16
- return feedback(["search", e.message]);
16
+ return debug(e.message);
17
17
  }
18
18
 
19
19
  function slice(content, min, max) {
@@ -32,7 +32,7 @@ function search(data) {
32
32
  }
33
33
  }
34
34
  } catch (e) {
35
- feedback(["search", e.message]);
35
+ debug(e.message);
36
36
  }
37
37
  try {
38
38
  if (page.content) {
@@ -40,7 +40,7 @@ function search(data) {
40
40
  content = page.content.match(regexp);
41
41
  }
42
42
  } catch (e) {
43
- feedback(["search", e.message]);
43
+ debug(e.message);
44
44
  }
45
45
  if (title || content) {
46
46
  let result = [`<a href="${ui.baseurl}${page.url}?highlight=${text}">${page.title}</a>`];
@@ -72,5 +72,5 @@ function search(data) {
72
72
  }
73
73
 
74
74
  $(document).ready(function() {
75
- $.ajax(`${ui.baseurl}/pages.json`).done(search).fail((xhr, message) => feedback(["search", message]));
75
+ $.ajax(`${ui.baseurl}/pages.json`).done(search).fail((xhr, message) => debug(message));
76
76
  });
@@ -0,0 +1,33 @@
1
+ self.addEventListener("activate", function(event) {
2
+ let cacheWhitelist = ["rundocs-{{ version }}"];
3
+
4
+ event.waitUntil(
5
+ caches.keys().then(function(keyList) {
6
+ return Promise.all(keyList.map(function(key) {
7
+ if (cacheWhitelist.indexOf(key) === -1) {
8
+ return caches.delete(key);
9
+ }
10
+ }));
11
+ })
12
+ );
13
+ });
14
+
15
+ self.addEventListener("fetch", function(e) {
16
+ if (/^https:\/\/cdn\.jsdelivr\.net\/gh\/rundocs\/jekyll-rtd-theme@.+/.exec(e.request.url)) {
17
+ e.respondWith(
18
+ caches.match(e.request).then(function(resp) {
19
+ if (resp !== undefined) {
20
+ return resp;
21
+ } else {
22
+ return fetch(e.request, { cache: "no-store" }).then(function(resp) {
23
+ let clone = resp.clone();
24
+ caches.open("rundocs-{{ version }}").then(function(cache) {
25
+ cache.put(e.request, clone);
26
+ });
27
+ return resp;
28
+ }).catch(console.log);
29
+ }
30
+ })
31
+ );
32
+ }
33
+ });
@@ -24,7 +24,7 @@
24
24
  {%- assign level = level | minus: 1 -%}
25
25
  {%- endif -%}
26
26
 
27
- <li class="toctree-l{{ level }} {{ current }}">
27
+ <li class="toctree-l{{ level }} {{ current }}" data-sort="{{ item.sort }}" data-level="{{ level }}">
28
28
  <a class="reference internal {{ current }}" href="{{ item.url | relative_url }}">
29
29
  {%- if item.sort and site.show_sorted != false -%}
30
30
  {{ item.sort }}. {{ item.title | default: item.url }}
File without changes
File without changes
@@ -1,14 +1,14 @@
1
1
  {%- assign description = content | strip_html | split: " " | join: " " | escape | truncate: 150 -%}
2
- {%- assign version = "1.1.1" -%}
2
+ {%- assign version = "1.1.6" -%}
3
3
  {%- assign addons = "github, i18n, plugins, analytics" | split: ", " -%}
4
4
 
5
5
  {%- assign schema_date = page.date | default: site.time | date_to_xmlschema -%}
6
6
  {%- assign schema_modi = site.time | date_to_xmlschema -%}
7
- {%- assign schema_surl = page.url | absolute_url | replace: 'http://', 'https://' | xml_escape -%}
7
+ {%- assign schema_surl = page.url | absolute_url | xml_escape -%}
8
8
 
9
9
  {% comment %} scss {% endcomment %}
10
10
  {%- capture site_scss -%}
11
- @import "site.scss";
11
+ @import "jekyll-rtd-theme.scss";
12
12
  {% if site.fluid %}@import "fluid.scss";{% endif %}
13
13
  {% include assets/custom.scss %} {{ site.scss }}
14
14
  {%- endcapture -%}
@@ -22,25 +22,15 @@
22
22
 
23
23
  {% comment %} github-metadata {% endcomment %}
24
24
  {%- if site.github_metadata != false -%}
25
- {%- if jekyll.environment == "production" -%}
26
- {%- assign author = site.author | default: site.github.owner_name -%}
27
- {%- assign branch = site.github.source.branch -%}
28
- {%- assign commit = site.github.build_revision | slice: 0, 7 -%}
29
- {%- assign repository_url = site.github.repository_url -%}
30
- {%- assign issues_url = site.github.issues_url -%}
31
- {%- assign zip_url = site.github.zip_url -%}
32
- {%- capture github_edit_link %}{% github_edit_link %}{% endcapture -%}
33
- {%- else -%}
34
- {%- assign author = site.author | default: "[author]" -%}
35
- {%- assign branch = "[branch]" -%}
36
- {%- assign commit = "[commit]" -%}
37
- {%- assign repository_url = "#" -%}
38
- {%- assign issues_url = "#" -%}
39
- {%- assign zip_url = "#" -%}
40
- {%- assign github_edit_link = "#" -%}
41
- {%- endif -%}
25
+ {%- assign author = site.author | default: site.github.owner_name -%}
26
+ {%- assign branch = site.github.source.branch -%}
27
+ {%- assign commit = site.github.build_revision | slice: 0, 7 -%}
28
+ {%- assign repository_url = site.github.repository_url -%}
29
+ {%- assign issues_url = site.github.issues_url -%}
30
+ {%- assign zip_url = site.github.zip_url -%}
31
+ {%- capture github_edit_link %}{% github_edit_link %}{% endcapture -%}
42
32
  {%- else -%}
43
- {%- assign author = site.author | default: "[author]" -%}
33
+ {%- assign author = site.author -%}
44
34
  {%- assign branch = "" -%}
45
35
  {%- assign commit = "" -%}
46
36
  {%- assign repository_url = "" -%}
@@ -68,11 +58,13 @@
68
58
  {% comment %} content {% endcomment %}
69
59
  {%- assign content = content
70
60
  | replace: '’', "'"
71
- | replace: '<pre class="highlight"><code>', "<pre>"
72
- | replace: '<pre><code class=', "<pre class="
61
+ | replace: '<pre class="highlight"><code>', '<pre class="notranslate">'
62
+ | replace: '<pre><code class="', '<pre class="notranslate '
73
63
  | replace: "</code></pre>", "</pre>"
74
64
  | replace: '<code class="language-plaintext highlighter-rouge">', '<code class="literal">'
75
- | replace: "<table>", '<table class="docutils align-default">' -%}
65
+ | replace: "<dl>", '<dl class="definition">'
66
+ | replace: "<table>", '<div class="wy-table-responsive"><table class="docutils align-default">'
67
+ | replace: "</table>", '</table></div>' -%}
76
68
 
77
69
  {% comment %} prev and next {% endcomment %}
78
70
  {%- assign workdir_files = site_files | where_exp: "item", "item.dir == page.dir" -%}
@@ -10,9 +10,13 @@
10
10
  {%- capture current -%}
11
11
  {%- if page.url == item.url %}current{% endif -%}
12
12
  {%- endcapture %}
13
- <li class="toctree-l{{ level }} {{ current }}">
13
+ <li class="toctree-l{{ level }} {{ current }}" data-sort="{{ item.sort }}" data-level="{{ level }}">
14
14
  <a class="reference internal {{ current }}" href="{{ item.url | relative_url }}">
15
- {{ item.title | default: item.url }}
15
+ {%- if item.sort and site.show_sorted != false -%}
16
+ {{ item.sort }}. {{ item.title | default: item.url }}
17
+ {%- else -%}
18
+ {{ item.title | default: item.url }}
19
+ {%- endif -%}
16
20
  </a>
17
21
  </li>
18
22
  {%- endfor %}
@@ -28,13 +28,17 @@ layout: plugins/compress
28
28
  dataLayer.push(arguments);
29
29
  }
30
30
 
31
- function feedback(messages) {
32
- gtag("event", "exception", {
33
- "description": messages.join(":")
34
- });
31
+ function debug() {
32
+ console.debug.apply(console, arguments);
35
33
  }
36
34
 
37
35
  gtag("js", new Date());
36
+
37
+ if ("serviceWorker" in navigator) {
38
+ navigator.serviceWorker.register("{{ site.baseurl }}/sw.caches.js");
39
+ } else {
40
+ debug("Service Worker not supported!");
41
+ }
38
42
  </script>
39
43
  <!-- meta -->
40
44
  <meta name="description" content="{{ description }}">
@@ -85,12 +89,12 @@ layout: plugins/compress
85
89
  </script>
86
90
  <!-- link -->
87
91
  <link rel="canonical" href="{{ schema_surl }}">
88
- {% if prev %}<link rel="prev" href="{{ prev.url | absolute_url | replace: 'http://', 'https://' }}">{% endif %}
89
- {% if next %}<link rel="next" href="{{ next.url | absolute_url | replace: 'http://', 'https://' }}">{% endif %}
92
+ {% if prev %}<link rel="prev" href="{{ prev.url | absolute_url }}">{% endif %}
93
+ {% if next %}<link rel="next" href="{{ next.url | absolute_url }}">{% endif %}
90
94
  <!-- theme -->
91
95
  <link rel="stylesheet" href="{{ cdn }}/assets/css/theme.css">
92
96
  <link rel="stylesheet" href="{{ cdn }}/assets/css/rougify/{{ site.rougify | default: 'github' }}.css">
93
- <style>{{ site_scss | scssify }}</style>
97
+ <style>{{ site_scss | scssify | strip_newlines }}</style>
94
98
  <!-- icon -->
95
99
  <link rel="icon" type="image/svg+xml" href="{{ site.baseurl }}/favicon.svg">
96
100
  <!-- script -->
@@ -109,6 +113,7 @@ layout: plugins/compress
109
113
  }
110
114
  };
111
115
  </script>
116
+ {% include extra/head.html %}
112
117
  </head>
113
118
 
114
119
  <body class="wy-body-for-nav">
@@ -141,8 +146,12 @@ layout: plugins/compress
141
146
  <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
142
147
  <!-- MOBILE NAV -->
143
148
  <nav class="wy-nav-top" aria-label="top navigation">
144
- <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
145
- <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}">{{ site.title }}</a>
149
+ <div class="flex">
150
+ <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
151
+ <div class="wy-nav-title">
152
+ <a href="{{ site.baseurl }}/{% if site_lang != lang %}{{ lang }}/{% endif %}">{{ site.title }}</a>
153
+ </div>
154
+ </div>
146
155
  </nav>
147
156
  <div class="wy-nav-content">
148
157
  <div class="rst-content">
@@ -173,9 +182,21 @@ layout: plugins/compress
173
182
  </section>
174
183
  </div>
175
184
  {%- if site.addons %}{% include addons.liquid %}{% endif %}
185
+ {% include extra/footer.html %}
176
186
  <!-- script -->
177
- <script src="{{ cdn }}/assets/js/theme.js"></script>
178
187
  <script src="{{ cdn }}/assets/js/anchor.min.js"></script>
188
+
189
+ {% comment %} mermaid {% endcomment %}
190
+ {%- if content contains '<pre class="notranslate language-mermaid">' -%}
191
+ {%- if site.mermaid.custom -%}
192
+ <script src="{{ site.mermaid.custom }}"></script>
193
+ {%- else -%}
194
+ <script src="{{ cdn }}/assets/js/mermaid.min.js"></script>
195
+ {%- endif %}
196
+ <script>
197
+ mermaid.initialize({% if site.mermaid.initialize %}{{ site.mermaid.initialize | jsonify }}{% else %}{}{% endif %});
198
+ </script>
199
+ {%- endif %}
179
200
  <script>
180
201
  {% include assets/common.js %}
181
202
  {% include assets/custom.js %} {{ site.script }}