Skip to content

Commit cf0df8c

Browse files
committed
feat: Support browser-level image lazy-loading
1 parent bd662c4 commit cf0df8c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

docs/helpers.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ Only when you both set the `routerMode: 'history'` and `externalLinkTarget: '_se
121121
![logo](https://docsify.js.org/_media/icon.svg ':id=someCssId')
122122
```
123123

124+
### Lazy Loading
125+
126+
```md
127+
![logo](https://docsify.js.org/_media/icon.svg ':loading=lazy')
128+
```
129+
124130
## Customise ID for headings
125131

126132
```md

src/core/render/compiler/image.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export const imageCompiler = ({ renderer, contentBase, router }) =>
3434
attrs.push(`id="${config.id}"`);
3535
}
3636

37+
if (config.loading) {
38+
attrs.push(`loading="${config.loading}"`);
39+
}
40+
3741
if (!isAbsolutePath(href)) {
3842
url = getPath(contentBase, getParentPath(router.getCurrentPath()), href);
3943
}

0 commit comments

Comments
 (0)