mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
Merge pull request #842 from Koooooo-7/develop
fix #835 :Link target of repo's GitHub Corner add new independent config `cornerExternalLinkTarget`.
This commit is contained in:
commit
98525c4a2d
@ -397,7 +397,7 @@ window.$docsify = {
|
||||
- type: `String`
|
||||
- default: `_blank`
|
||||
|
||||
Target to open external links. Default `'_blank'` (new window/tab)
|
||||
Target to open external links inside the markdown. Default `'_blank'` (new window/tab)
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
@ -405,6 +405,19 @@ window.$docsify = {
|
||||
};
|
||||
```
|
||||
|
||||
## cornerExternalLinkTarget
|
||||
|
||||
- type:`String`
|
||||
- default:`_blank`
|
||||
|
||||
Target to open external link at the top right corner. Default `'_blank'` (new window/tab)
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
cornerExternalLinkTarget: '_self' // default: '_blank'
|
||||
};
|
||||
```
|
||||
|
||||
## routerMode
|
||||
|
||||
- type: `String`
|
||||
|
||||
@ -23,7 +23,10 @@ export default function () {
|
||||
ext: '.md',
|
||||
mergeNavbar: false,
|
||||
formatUpdated: '',
|
||||
// this config for the links inside markdown
|
||||
externalLinkTarget: '_blank',
|
||||
// this config for the corner
|
||||
cornerExternalLinkTarget: '_blank',
|
||||
routerMode: 'hash',
|
||||
noCompileLinks: [],
|
||||
relativePath: false
|
||||
|
||||
@ -226,7 +226,7 @@ export function initRender(vm) {
|
||||
|
||||
if (el) {
|
||||
if (config.repo) {
|
||||
html += tpl.corner(config.repo)
|
||||
html += tpl.corner(config.repo, config.cornerExternalLinkTarge)
|
||||
}
|
||||
if (config.coverpage) {
|
||||
html += tpl.cover()
|
||||
|
||||
@ -4,7 +4,7 @@ import {isMobile} from '../util/env'
|
||||
* @param {Object} data
|
||||
* @return {String}
|
||||
*/
|
||||
export function corner(data) {
|
||||
export function corner(data, cornerExternalLinkTarge) {
|
||||
if (!data) {
|
||||
return ''
|
||||
}
|
||||
@ -12,9 +12,11 @@ export function corner(data) {
|
||||
data = 'https://github.com/' + data
|
||||
}
|
||||
data = data.replace(/^git\+/, '')
|
||||
// double check
|
||||
cornerExternalLinkTarge = cornerExternalLinkTarge || '_blank'
|
||||
|
||||
return (
|
||||
`<a href="${data}" class="github-corner" aria-label="View source on Github">` +
|
||||
`<a href="${data}" target="${cornerExternalLinkTarge}" class="github-corner" aria-label="View source on Github">` +
|
||||
'<svg viewBox="0 0 250 250" aria-hidden="true">' +
|
||||
'<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>' +
|
||||
'<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>' +
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user