docs: validate hashes exist when using {% url %} tag helper

This commit is contained in:
Brian Mann
2017-06-09 12:44:59 -04:00
parent 2d8b578f10
commit 81e4cbf1b4
4 changed files with 154 additions and 31 deletions
+7 -1
View File
@@ -91,7 +91,13 @@ hexo.extend.tag.register('url', function (args) {
attrs.target = '_blank'
}
return urlGenerator.validateAndGetUrl(sidebar, attrs.href)
// onRender callback to generate
// the markdown for each internal document
const onRender = (text) => {
return hexo.render.render({ text, engine: 'markdown' })
}
return urlGenerator.validateAndGetUrl(sidebar, attrs.href, this.full_source, onRender)
.then((href) => {
attrs.href = href