-
I wrote a component that lets me caption an image like this: <ImgCaption title="A trash can" src="./images/trash.jpg">
Photo by <a href="https://unsplash.com/@pawel_czerwinski">Pawel Czerwinski</a>
on <a href="https://unsplash.com/s/photos/trash">>Unsplash</a>
</ImgCaption> The document containing this is in
Now, I know that this is really a Vuepress issue, but My component looks like: <template>
<figure>
<img :src="src" :title="title">
<figcaption>
<slot></slot>
</figcaption>
</figure>
</template>
<script>
export default {
props: [
"src", "title"
],
}
</script> |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Sorry, I just see this discussion, I will check it out now. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
In case anyone else comes across this, I ended up solving it with ['@vuepress/plugin-container', {
type: 'caption',
before: (src: string) => {
return `<figure class="with-caption">\n<img src="${src}"/>\n<figcaption>`
},
after: (_: any) => '</figcaption></figure>',
}], So you'd use it like this: ::: caption @source/posts/images/Rubber_duck_assisting_with_debugging.jpg
By Tom Morris (Own work)
[CC-BY-SA-3.0](http://creativecommons.org/licenses/by-sa/3.0) or [GFDL](http://www.gnu.org/copyleft/fdl.html), via Wikimedia Commons
::: (I couldn't get it work with relative paths...) |
Beta Was this translation helpful? Give feedback.
In case anyone else comes across this, I ended up solving it with
So you'd use it like this:
(I couldn't get it work with relative paths...)