Fixed render link

This commit is contained in:
qingwei.li 2016-12-23 01:20:28 +08:00
parent 4c8c0349e6
commit 64309beee9
4 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.DS_Store
*.log
node_modules
yarn.lock

View File

@ -1,3 +1,8 @@
## 1.3.2
### Bug fixes
- Fixed render link
## 1.3.1
### Bug fixes

View File

@ -1,6 +1,6 @@
![logo](_media/icon.svg)
# docsify <small>1.3.1</small>
# docsify <small>1.3.2</small>
> A magical documentation site generator.

View File

@ -42,7 +42,7 @@ renderer.code = function (code, lang = '') {
}
renderer.link = function (href, title, text) {
if (OPTIONS.router && !/^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/.test(href)) {
href = !/^\/#/.test(href) ? `#/${getRoute()}${href}` : href
href = `#/${href}`.replace(/\/\//g, '/')
}
return `<a href="${href}" title="${title || ''}">${text}</a>`