fix(image-embed): handle embedding external image

- move to site script to make theme more generic
This commit is contained in:
MDLeom 2020-03-08 09:39:14 +00:00
parent 397eadae2a
commit 81e08296fa
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
1 changed files with 3 additions and 0 deletions

View File

@ -21,6 +21,9 @@ hexo.extend.filter.register('marked:renderer', (renderer) => {
// See source/_redirects
const link = '/img/'
// embed external image
if (!href.startsWith('20')) return `<img src="${href}" alt="${alt}" title="${title}">`
if (href.endsWith('.png') || href.endsWith('.jpg')) {
modern = href.concat('?format=webp')
} else if (href.endsWith('.webp')) {