Skip to content

Commit e61410a

Browse files
committed
add new config cornerExternalLinkTarget for the corner link target
rm CNAME add CNAME add repo test back to the origin index.html fix: the Git corner displayed bigger when the externalLinkTarget = '' [update] a new independent config for corner link target attribute. [update doc] add the `cornerExternalLinkTarget` config in the doc.
1 parent 12d80f6 commit e61410a

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

Diff for: docs/configuration.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,27 @@ window.$docsify = {
397397
- type: `String`
398398
- default: `_blank`
399399

400-
Target to open external links. Default `'_blank'` (new window/tab)
400+
Target to open external links inside the markdown. Default `'_blank'` (new window/tab)
401401

402402
```js
403403
window.$docsify = {
404404
externalLinkTarget: '_self' // default: '_blank'
405405
};
406406
```
407407

408+
## cornerExternalLinkTarget
409+
410+
- type:`String`
411+
- default:`_blank`
412+
413+
Target to open external link at the top right corner. Default `'_blank'` (new window/tab)
414+
415+
```js
416+
window.$docsify = {
417+
cornerExternalLinkTarget: '_self' // default: '_blank'
418+
};
419+
```
420+
408421
## routerMode
409422

410423
- type: `String`

Diff for: src/core/config.js

+3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export default function () {
2323
ext: '.md',
2424
mergeNavbar: false,
2525
formatUpdated: '',
26+
// this config for the links inside markdown
2627
externalLinkTarget: '_blank',
28+
// this config for the corner
29+
cornerExternalLinkTarget: '_blank',
2730
routerMode: 'hash',
2831
noCompileLinks: [],
2932
relativePath: false

Diff for: src/core/render/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export function initRender(vm) {
226226

227227
if (el) {
228228
if (config.repo) {
229-
html += tpl.corner(config.repo, config.externalLinkTarget)
229+
html += tpl.corner(config.repo, config.cornerExternalLinkTarge)
230230
}
231231
if (config.coverpage) {
232232
html += tpl.cover()

Diff for: src/core/render/tpl.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ import {isMobile} from '../util/env'
44
* @param {Object} data
55
* @return {String}
66
*/
7-
export function corner(data, externalLinkTarget) {
7+
export function corner(data, cornerExternalLinkTarge) {
88
if (!data) {
99
return ''
1010
}
1111
if (!/\/\//.test(data)) {
1212
data = 'https://github.com/' + data
1313
}
1414
data = data.replace(/^git\+/, '')
15+
// double check
16+
cornerExternalLinkTarge = cornerExternalLinkTarge || '_blank'
1517

1618
return (
17-
`<a href="${data}" target="${externalLinkTarget}" class="github-corner" aria-label="View source on Github">` +
19+
`<a href="${data}" target="${cornerExternalLinkTarge}" class="github-corner" aria-label="View source on Github">` +
1820
'<svg viewBox="0 0 250 250" aria-hidden="true">' +
1921
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
2022
'<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>' +

0 commit comments

Comments
 (0)