Ghost 集成Kroki
安装Kroki
使用Docker安装Kroki
version: '3'
services:
kroki:
image: 'yuzutech/kroki:latest'
container_name: kroki
restart: always
ports:
- '8000:8000'
配置Ghost的Nginx
location /kroki/ {
proxy_pass http://kroki:8000/;
}
Ghost配置
在code-injection 的Site Footer中加入以下脚本
<script>
let plantumlCodes=$("code.language-plantuml")
plantumlCodes.each(function(index,element){
let _this=$(this);
let renderBody=_this.parent()
$.ajax({
url: "/kroki/plantuml/svg",
headers: {
Accept: "image/svg+xml",
"Content-Type": "text/plain; charset=utf-8"
},
data: _this.html(),
method: "POST",
success: function (result) {
renderBody.empty();
renderBody.get(0).appendChild(result.children[0]);
}
})
})
</script>
验证
class A
class B extends A