Fix(image-alt): Alt tag blank even if provided

Alt tag was not being rendered even if provided.

Referenced code from the `markdown-it` repo.
pull/679/head
Brad Veryard 3 years ago
parent 7cffbbb2df
commit 41433b9a36

@ -54,3 +54,6 @@ VitePress is future oriented: VitePress only targets browsers that support nativ
We already have [vuepress-next](https://github.com/vuepress/vuepress-next), which would be the next major version of VuePress. It also makes lots of improvements over VuePress v1, and also supports Vite now.
VitePress is not compatible with the current VuePress ecosystem (mostly themes and plugins). The overall idea is that VitePress will have a drastically more minimal theming API (preferring JavaScript APIs instead of file layout conventions) and likely no plugins (all customization is done in themes).
![sdsd](/vue-logo.png "Title Here")

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

@ -10,6 +10,11 @@ export const imagePlugin = (md: MarkdownIt) => {
if (url && !EXTERNAL_URL_RE.test(url) && !/^\.?\//.test(url)) {
token.attrSet('src', './' + url)
}
// https://github.com/markdown-it/markdown-it/blob/1529ff4944329eb8080a8558dab85164b6c212cd/lib/renderer.js#L101
if (token.attrIndex('alt') && token.children !== null) {
token.attrs![token.attrIndex('alt')][1] = self.renderInlineAsText(token.children, options, env);
}
return self.renderToken(tokens, idx, options)
}
}

Loading…
Cancel
Save