diff --git a/docs/helpers.md b/docs/helpers.md index 59a299cf7..764b88a86 100644 --- a/docs/helpers.md +++ b/docs/helpers.md @@ -66,17 +66,27 @@ You will get `link`html. Do not worry, you can still set ti ## Github Task Lists ```md -* [ ] foo -* bar -* [x] baz -* [] bam <~ not working - * [ ] bim - * [ ] lim +- [ ] foo +- bar +- [x] baz +- [] bam <~ not working + - [ ] bim + - [ ] lim ``` -* [ ] foo -* bar -* [x] baz -* [] bam <~ not working - * [ ] bim - * [ ] lim +- [ ] foo +- bar +- [x] baz +- [] bam <~ not working + - [ ] bim + - [ ] lim + +## Image resizing + +```md +![logo](https://docsify.js.org/_media/icon.svg ':size=50x100') +![logo](https://docsify.js.org/_media/icon.svg ':size=100') +``` + +![logo](https://docsify.js.org/_media/icon.svg ':size=50x100') +![logo](https://docsify.js.org/_media/icon.svg ':size=100') diff --git a/src/core/render/compiler.js b/src/core/render/compiler.js index 82544ce92..49242084b 100644 --- a/src/core/render/compiler.js +++ b/src/core/render/compiler.js @@ -257,6 +257,16 @@ export class Compiler { attrs += ` title="${title}"` } + const size = config.size + if (size) { + const sizes = size.split('x') + if (sizes[1]) { + attrs += 'width=' + sizes[0] + ' height=' + sizes[1] + } else { + attrs += 'width=' + sizes[0] + } + } + if (!isAbsolutePath(href)) { url = getPath(contentBase, getParentPath(router.getCurrentPath()), href) }