1 Star 0 Fork 0

JakeYang/hexo-filter-markdown-plantuml

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
plantuml.js 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
JakeYang 提交于 2020-01-16 14:27 . init
var deflate = require('./deflate');
var encode64 = function(data) {
r = "";
for (i = 0; i < data.length; i += 3) {
if (i + 2 == data.length) {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0);
} else if (i + 1 == data.length) {
r += append3bytes(data.charCodeAt(i), 0, 0);
} else {
r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), data.charCodeAt(i + 2));
}
}
return r;
};
var append3bytes = function(b1, b2, b3) {
c1 = b1 >> 2;
c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
c3 = ((b2 & 0xF) << 2) | (b3 >> 6);
c4 = b3 & 0x3F;
r = "";
r += encode6bit(c1 & 0x3F);
r += encode6bit(c2 & 0x3F);
r += encode6bit(c3 & 0x3F);
r += encode6bit(c4 & 0x3F);
return r;
};
var encode6bit = function(b) {
if (b < 10) {
return String.fromCharCode(48 + b);
}
b -= 10;
if (b < 26) {
return String.fromCharCode(65 + b);
}
b -= 26;
if (b < 26) {
return String.fromCharCode(97 + b);
}
b -= 26;
if (b == 0) {
return '-';
}
if (b == 1) {
return '_';
}
return '?';
};
exports.compress = function(s) {
s = unescape(encodeURIComponent(s));
return "http://www.plantuml.com/plantuml/svg/" + encode64(deflate.zip_deflate(s, 9));
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/add358/hexo-filter-markdown-plantuml.git
git@gitee.com:add358/hexo-filter-markdown-plantuml.git
add358
hexo-filter-markdown-plantuml
hexo-filter-markdown-plantuml
master

搜索帮助