feat(compiler): support for setting target attribute for link, fixed #230
This commit is contained in:
parent
c3a149679a
commit
7f270f93c6
4 changed files with 28 additions and 0 deletions
|
|
@ -49,3 +49,10 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
|||
|
||||
<a href="/demo/" title="title">link</a>
|
||||
```
|
||||
|
||||
## Set target attribute for link
|
||||
|
||||
```md
|
||||
[link](/demo ":target=_blank")
|
||||
[link](/demo2 ":target=_self")
|
||||
```
|
||||
|
|
|
|||
|
|
@ -50,3 +50,10 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
|||
<a href="/demo/" title="title">link</a>
|
||||
```
|
||||
|
||||
## Set target attribute for link
|
||||
|
||||
```md
|
||||
[link](/demo ":target=_blank")
|
||||
[link](/demo2 ":target=_self")
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -49,3 +49,10 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
|
|||
<a href="/demo/" title="title">link</a>
|
||||
```
|
||||
|
||||
|
||||
## Set target attribute for link
|
||||
|
||||
```md
|
||||
[link](/demo ":target=_blank")
|
||||
[link](/demo2 ":target=_self")
|
||||
```
|
||||
|
|
|
|||
|
|
@ -105,6 +105,13 @@ export class Compiler {
|
|||
title = title && title.replace(/:ignore/g, '').trim()
|
||||
}
|
||||
|
||||
let target = title && title.match(/:target=\w+/)
|
||||
if (target) {
|
||||
target = target[0]
|
||||
title = title.replace(target, '')
|
||||
blank = ' ' + target.slice(1)
|
||||
}
|
||||
|
||||
if (title) {
|
||||
title = ` title="${title}"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue