Skip to content

Commit e221023

Browse files
committed
fix: render image in absolute path
1 parent 3c9b3d9 commit e221023

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/helpers.md

+14
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Only when you set both the `routerMode: 'history'` and `externalLinkTarget: '_se
9595

9696
### Resizing
9797

98+
9899
```md
99100
![logo](https://docsify.js.org/_media/icon.svg ':size=WIDTHxHEIGHT')
100101
![logo](https://docsify.js.org/_media/icon.svg ':size=50x100')
@@ -121,6 +122,19 @@ Only when you set both the `routerMode: 'history'` and `externalLinkTarget: '_se
121122
![logo](https://docsify.js.org/_media/icon.svg ':id=someCssId')
122123
```
123124

125+
### Absolute Path
126+
127+
```md
128+
129+
![logo](:docs/_media/icon.svg 'with :')
130+
![logo](//docs/_media/icon.svg 'with //')
131+
132+
```
133+
134+
![logo](:docs/_media/icon.svg 'with :')
135+
136+
![logo](//docs/_media/icon.svg 'with //')
137+
124138
## Customise ID for headings
125139

126140
```md

src/core/render/compiler/image.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isAbsolutePath, getPath, getParentPath } from '../../router/util';
33

44
export const imageCompiler = ({ renderer, contentBase, router }) =>
55
(renderer.image = (href, title, text) => {
6-
let url = href;
6+
let url = href.replace(/^\/+|^:/, '');
77
let attrs = [];
88

99
const { str, config } = getAndRemoveConfig(title);

0 commit comments

Comments
 (0)