diff --git a/docs/de-de/helpers.md b/docs/de-de/helpers.md index 5a9e477..8cfe310 100644 --- a/docs/de-de/helpers.md +++ b/docs/de-de/helpers.md @@ -49,3 +49,10 @@ You will get `link`html. Do not worry, you can still set ti link ``` + +## Set target attribute for link + +```md +[link](/demo ":target=_blank") +[link](/demo2 ":target=_self") +``` diff --git a/docs/helpers.md b/docs/helpers.md index aec7766..7c64310 100644 --- a/docs/helpers.md +++ b/docs/helpers.md @@ -50,3 +50,10 @@ You will get `link`html. Do not worry, you can still set ti link ``` +## Set target attribute for link + +```md +[link](/demo ":target=_blank") +[link](/demo2 ":target=_self") +``` + diff --git a/docs/zh-cn/helpers.md b/docs/zh-cn/helpers.md index ab41b39..eec2026 100644 --- a/docs/zh-cn/helpers.md +++ b/docs/zh-cn/helpers.md @@ -49,3 +49,10 @@ You will get `link`html. Do not worry, you can still set ti link ``` + +## Set target attribute for link + +```md +[link](/demo ":target=_blank") +[link](/demo2 ":target=_self") +``` diff --git a/src/core/render/compiler.js b/src/core/render/compiler.js index 5848af6..845af04 100644 --- a/src/core/render/compiler.js +++ b/src/core/render/compiler.js @@ -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}"` }