Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zhaohuabing/hugo-theme-cleanwhite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaohuabing <zhaohuabing@gmail.com>2022-06-30 08:31:56 +0300
committerzhaohuabing <zhaohuabing@gmail.com>2022-06-30 08:44:32 +0300
commitc48c8628f6c6938dd1c1c52a00521f6785e34706 (patch)
tree00c1405d683a88318ad39c72b7b512c5429aae23 /layouts
parentfe526c5444d5e533c71d49f83ec2d46b129f4ea7 (diff)
support plantuml
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/footer.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index f061726..281587e 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -430,3 +430,19 @@
</script>
{{ end }}
+{{ if or .Page.Params.plantuml .Site.Params.plantuml }}
+<!-- PlantUML -->
+<script src="https://cdn.jsdelivr.net/gh/jmnote/plantuml-encoder@1.2.4/dist/plantuml-encoder.min.js" integrity="sha256-Qsk2KRBCN5qVZX7B+8+2IvQl1Aqc723qV1tBCQaVoqo=" crossorigin="anonymous"></script>
+<script>
+(function(){
+ let plantumlPrefix = "language-plantuml";
+ Array.prototype.forEach.call(document.querySelectorAll("[class^=" + plantumlPrefix + "]"), function(code){
+ let image = document.createElement("IMG");
+ image.loading = 'lazy'; // Lazy loading
+ image.src = 'http://www.plantuml.com/plantuml/svg/~1' + plantumlEncoder.encode(code.innerText);
+ code.parentNode.parentNode.insertBefore(image, code.parentNode);
+ code.parentNode.style.display = 'none';
+ });
+})();
+</script>
+{{ end }}