文档里的外部链接添加图标进行标识

This commit is contained in:
zmister 2021-02-10 21:05:25 +08:00
parent 4e1c9d5f14
commit 390a8d06ad
11 changed files with 58 additions and 7 deletions

View File

@ -30,6 +30,12 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe7c2;</span>
<div class="name">外链</div>
<div class="code-name">&amp;#xe7c2;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe627;</span>
<div class="name">置顶</div>
@ -356,6 +362,15 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont mrdoc-icon-wailian"></span>
<div class="name">
外链
</div>
<div class="code-name">.mrdoc-icon-wailian
</div>
</li>
<li class="dib">
<span class="icon iconfont mrdoc-icon-totop"></span>
<div class="name">
@ -799,6 +814,14 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#mrdoc-icon-wailian"></use>
</svg>
<div class="name">外链</div>
<div class="code-name">#mrdoc-icon-wailian</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#mrdoc-icon-totop"></use>

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "mrdoc-icon-",
"description": "用于觅道文档的文集文档图标",
"glyphs": [
{
"icon_id": "17162009",
"name": "外链",
"font_class": "wailian",
"unicode": "e7c2",
"unicode_decimal": 59330
},
{
"icon_id": "1940382",
"name": "置顶",

View File

@ -20,6 +20,9 @@ Created by iconfont
/>
<missing-glyph />
<glyph glyph-name="wailian" unicode="&#59330;" d="M982.584889 290.360889a45.511111 45.511111 0 0 1-45.511111-45.511111v-258.161778a23.552 23.552 0 0 0-23.438222-23.438222H195.015111a23.552 23.552 0 0 0-23.552 23.438222v744.106667c0 12.970667 10.581333 23.552 23.552 23.552H517.688889a45.511111 45.511111 0 0 1 0 90.794666H195.128889C132.096 845.141333 81.009778 793.941333 81.009778 731.022222v-744.220444c0-62.919111 51.2-114.119111 114.119111-114.119111h718.620444c63.032889 0 114.346667 51.2 114.346667 114.232889V245.191111a45.624889 45.624889 0 0 1-45.511111 45.283556zM508.814222 556.828444c-34.588444-52.224-58.026667-110.819556-69.176889-172.373333a45.511111 45.511111 0 0 1 89.656889-13.312c9.557333 49.152 28.672 95.914667 56.433778 137.557333 58.709333 86.812444 146.318222 130.844444 260.551111 131.413334l4.778667-0.341334a45.511111 45.511111 0 0 1 45.397333 45.397334v53.248L1023.772444 617.244444l-127.431111-106.154666v43.235555a45.511111 45.511111 0 0 1-91.022222 0v-140.060444a45.511111 45.511111 0 0 1 74.410667-34.929778l240.867555 200.704a45.283556 45.283556 0 0 1 2.275556 67.811556L882.005333 876.999111a45.056 45.056 0 0 1-76.572444-32.881778v-115.143111c-159.288889-13.312-249.173333-100.693333-296.846222-172.145778h0.113777z" horiz-adv-x="1137" />
<glyph glyph-name="totop" unicode="&#58919;" d="M937.448 334.068l-367.933 395.045c-14.946 16.067-35.889 25.283-57.515 25.283s-42.594-9.216-57.515-25.259l-367.933-395.045c-26.673-28.672-19.505-54.857-15.189-64.805 4.315-9.923 18.603-33.036 57.758-33.036h153.259c0.414 0 0.902-0.512 0.902-0.902v-281.917c0.055-44.952 36.481-81.377 81.427-81.432l294.6-0c44.957 0.042 81.391 36.475 81.432 81.428l0 281.897c0 0.414 0.512 0.902 0.902 0.902h153.234c39.131 0 53.419 23.113 57.758 33.036 4.315 9.972 11.508 36.157-15.189 64.805zM116.126 815.445h791.747c0 0 0 0 0 0 22.245 0 40.277 18.033 40.277 40.277 0 22.245-18.033 40.277-40.277 40.277-0 0-0 0-0 0h-791.747c-22.245 0-40.277-18.033-40.277-40.277 0-22.245 18.033-40.277 40.277-40.277z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -153,6 +153,11 @@ ul#doc-tree{
/* font-weight: 700; */
font-family: Consolas,Menlo,Courier,monospace;
}
/* 为外部链接添加图标指示 */
.external::after {
content: '\e7c2';
font-family: 'iconfont';
}
@media screen and (max-width:768px){
.project-toc-left{
border-top:1px dashed #d8d8d8;

View File

@ -445,6 +445,15 @@
}
})
});
// 外部链接添加图标
document.addEventListener('DOMContentLoaded', function() {
Array.prototype.filter.call(document.links, function(link) {
return link.hostname && link.hostname !== location.hostname;
})
.forEach(function(link) {
link.classList.add('external');
});
});
</script>