diff --git a/src/components/ImageZoom.vue b/src/components/ImageZoom.vue index b299a190..ef69ca2e 100644 --- a/src/components/ImageZoom.vue +++ b/src/components/ImageZoom.vue @@ -1,6 +1,6 @@ @@ -10,8 +10,10 @@ export default { props: { url: { - type: String, - required: true + type: String + }, + src: { + type: String }, alt: { type: String @@ -22,6 +24,15 @@ export default { }, width: { type: [String, Number] + }, + title: { + type: String + } + }, + + computed: { + imageURL() { + return this.src || this.url } }, diff --git a/src/store.js b/src/store.js index 516686aa..5842290f 100644 --- a/src/store.js +++ b/src/store.js @@ -108,7 +108,8 @@ const store = new Vuex.Store({ const env = { headings: [], - mixins: [] + mixins: [], + config: getters.config } if (page.markdown) { page.content = marked(page.content, { diff --git a/src/utils/marked.js b/src/utils/marked.js index c80205e1..e9d29b49 100644 --- a/src/utils/marked.js +++ b/src/utils/marked.js @@ -1123,14 +1123,20 @@ Renderer.prototype.link = function(href, title, text) { return out } +// @modified Renderer.prototype.image = function(href, title, text) { if (this.options.baseUrl && !originIndependentUrl.test(href)) { href = resolveUrl(this.options.baseUrl, href) } - var out = '' + text + '' : '>' return out } diff --git a/website/docs/builtin-components.md b/website/docs/builtin-components.md index 61930858..c9bec423 100644 --- a/website/docs/builtin-components.md +++ b/website/docs/builtin-components.md @@ -8,7 +8,8 @@ Use medium-style zoom effect to display certain image. | Prop | Type | Default | Description | | ------ | --------- | ------- | ------------------------ | -| url | `string` | N/A | URL to image | +| src | `string` | N/A | URL to image | +| title | `string` | N/A | Image title | | alt | `string` | N/A | Placeholder text | | border | `boolean` | `false` | Show border around image | | width | `string` | N/A | Image width | @@ -19,13 +20,13 @@ Example: ```markdown ``` - + ## `` diff --git a/website/docs/guide/deployment.md b/website/docs/guide/deployment.md index d8ba58a5..781dd183 100644 --- a/website/docs/guide/deployment.md +++ b/website/docs/guide/deployment.md @@ -22,7 +22,7 @@ Render offers [free static site hosting](https://render.com/docs/static-sites) w The easiest way to use GitHub Pages is to populate all your files inside `./docs` folder on the master branch, and then use this folder for GitHub Pages: - + However you can still use `gh-pages` branch or even `master` branch to serve your docs, it all depends on your needs. diff --git a/website/docs/guide/plugin.md b/website/docs/guide/plugin.md index 32d9858c..f286b18d 100644 --- a/website/docs/guide/plugin.md +++ b/website/docs/guide/plugin.md @@ -30,7 +30,7 @@ Example: {author} ``` - + --- diff --git a/website/docs/options.md b/website/docs/options.md index 828c0d35..87a1588c 100644 --- a/website/docs/options.md +++ b/website/docs/options.md @@ -249,6 +249,15 @@ new Docute({ }) ``` +## imageZoom + +- Type: `boolean` +- Default: `undefined` + +Enable Medium-like image zoom effect to all images. + +Alternatively you can use the [``](./builtin-components.md#imagezoom) component if you only need this in specific images. + ## fetchOptions - Type: `object` diff --git a/website/docs/zh/builtin-components.md b/website/docs/zh/builtin-components.md index d720e20a..3d5aff76 100644 --- a/website/docs/zh/builtin-components.md +++ b/website/docs/zh/builtin-components.md @@ -9,6 +9,7 @@ Docute 附带一些内置的 Vue 组件。 |属性|类型|默认值|描述| |---|---|---|---| |url|`string`|N/A|Image 的 URL| +| title | `string` | N/A | Image title | |alt|`string`|N/A|占位文字| |border|`boolean`|`false`|是否显示图像周围的边框| |width|`string`|N/A|Image 宽度| @@ -17,13 +18,13 @@ Docute 附带一些内置的 Vue 组件。 ```markdown ``` - + ## `` diff --git a/website/docs/zh/guide/deployment.md b/website/docs/zh/guide/deployment.md index dbd11482..3397f677 100644 --- a/website/docs/zh/guide/deployment.md +++ b/website/docs/zh/guide/deployment.md @@ -36,6 +36,6 @@ Make sure to check out Now's [GitHub Integration](https://zeit.co/docs/v2/integr 使用 Github Pages 最简单的方式是在 master 分支上的 `./docs` 文件夹中加入所有文件,然后将此文件夹用于 Github Pages: - + 但是你仍然可以使用 `gh-pages` 分支或者 `master` 分支来为你的文档提供服务,这一切都取决于你的需求。 diff --git a/website/docs/zh/guide/plugin.md b/website/docs/zh/guide/plugin.md index 239bfd16..dd773b45 100644 --- a/website/docs/zh/guide/plugin.md +++ b/website/docs/zh/guide/plugin.md @@ -30,7 +30,7 @@ new Docute({ {author} ``` - + --- diff --git a/website/docs/zh/options.md b/website/docs/zh/options.md index dea57a30..35bcd091 100644 --- a/website/docs/zh/options.md +++ b/website/docs/zh/options.md @@ -248,6 +248,15 @@ new Docute({ }) ``` +## imageZoom + +- Type: `boolean` +- Default: `undefined` + +Enable Medium-like image zoom effect to all images. + +Alternatively you can use the [``](./builtin-components.md#imagezoom) component if you only need this in specific images. + ## fetchOptions - Type: `object`