Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Inserting-Figures.md - github.com/AmazingRise/hugo-theme-diary.wiki.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 066550df3d5d46586d087826b5a9a938f34c9318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Inspired by [this issue](https://github.com/AmazingRise/hugo-theme-diary/issues/55), I ported a shortcode from [cupper-hugo-theme](https://github.com/zwbetz-gh/cupper-hugo-theme).
Thanks for [zwbetz-gh](https://github.com/zwbetz-gh)'s code.

Additionally, I add a property `align`, for defining how figure aligns.

```
{{< insertFigure
img="resource_name" 
caption="This is an example figure. For details, view [here](https://github.com/AmazingRise/hugo-theme-diary/issues/55)." 
command="Resize" 
align="Right"
options="700x" >}}
```

NOTE:
- `img` must be a resource name. [How to define a source?](https://gohugo.io/content-management/page-resources/#resources-metadata-example)
- Possible value for align: `Left`, `Right`, `Center`, `Justify` (it is not case-sensitive).
- The value of command must be one of `Fit`, `Fill`, `Resize`, `Original`.
- In fact, this is a shortcut of [Image processing methods](https://gohugo.io/content-management/image-processing/#image-processing-methods). See code for details.