35 Star 507 Fork 135

GVPdocsifyjs/docsify

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
external-script.js 748 Bytes
一键复制 编辑 原始数据 按行查看 历史
const window = /** @type {any} */ (globalThis);
function handleExternalScript() {
const container = Docsify.dom.getNode('#main');
const scripts = /** @type {HTMLScriptElement[]} */ (
Docsify.dom.findAll(container, 'script')
);
for (const script of scripts) {
if (script.src) {
const newScript = document.createElement('script');
Array.from(script.attributes).forEach(attribute => {
newScript[attribute.name] = attribute.value;
});
script.before(newScript);
script.remove();
}
}
}
const install = function (hook) {
hook.doneEach(handleExternalScript);
};
window.$docsify = window.$docsify || {};
window.$docsify.plugins = [install, ...(window.$docsify.plugins || [])];
export {};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/docsifyjs/docsify.git
git@gitee.com:docsifyjs/docsify.git
docsifyjs
docsify
docsify
develop

搜索帮助