Skip to content

Commit 809927b

Browse files
committed
fix image syntax example (close #12)
1 parent adcbeb1 commit 809927b

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

docs/guide/assets.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,30 @@
55
All markdown files are compiled into Vue components and processed by webpack, therefore you can and **should prefer** referencing any asset using relative URLs:
66

77
``` md
8-
![An image][./image.png]
8+
![An image](./image.png)
99
```
1010

1111
This would work the same way as in `*.vue` file templates. The image will be processed with `url-loader` and `file-loader`, and copied to appropriate locations in the generated static build.
1212

1313
In addition, you can use the `~` prefix to explicitly indicate this is a webpack module request, allowing you to reference files with webpack aliases or from npm dependencies:
1414

1515
``` md
16-
![Image from alias][~@assets/image.png]
17-
![Image from dependency][~some-dependency/image.png]
16+
![Image from alias](~@alias/image.png)
17+
![Image from dependency](~some-dependency/image.png)
18+
```
19+
20+
webpack aliases can be configured via [configureWebpack](/config/#configurewebpack) in `.vuepress/config.js`. Example:
21+
22+
``` js
23+
module.exports = {
24+
configurewebpack: {
25+
resolve: {
26+
alias: {
27+
'@alias': 'path/to/some/dir'
28+
}
29+
}
30+
}
31+
}
1832
```
1933

2034
## Public Files

0 commit comments

Comments
 (0)