mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
Merge pull request #2591 from pwhittlesea/support-markdown-attributes-on-images
✨ Support Hugo Markdown Attributes for Inline Images
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
[goldmark.parser]
|
[goldmark.parser]
|
||||||
wrapStandAloneImageWithinParagraph = false
|
wrapStandAloneImageWithinParagraph = false
|
||||||
|
|
||||||
|
[goldmark.parser.attribute]
|
||||||
|
block = true
|
||||||
|
|
||||||
[goldmark.renderer]
|
[goldmark.renderer]
|
||||||
unsafe = true
|
unsafe = true
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
[goldmark.parser]
|
[goldmark.parser]
|
||||||
wrapStandAloneImageWithinParagraph = false
|
wrapStandAloneImageWithinParagraph = false
|
||||||
|
|
||||||
|
[goldmark.parser.attribute]
|
||||||
|
block = true
|
||||||
|
|
||||||
[goldmark.renderer]
|
[goldmark.renderer]
|
||||||
unsafe = true
|
unsafe = true
|
||||||
|
|
||||||
|
|||||||
@@ -143,4 +143,28 @@ X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
|||||||
|
|
||||||
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
|
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
|
||||||
|
|
||||||
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
||||||
|
|
||||||
|
## Images
|
||||||
|
|
||||||
|
In addition to the [Figure Shortcode]({{< ref "../../docs/shortcodes#figure" >}}), you can define images using the following Markdown syntax:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can also leverage Hugos ['Markdown attributes'](https://gohugo.io/content-management/markdown-attributes/) feature to add custom attributes to the created HTML element.
|
||||||
|
For example, to set the width of an image to 50%:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
|
||||||
|
Note that the 'Markdown attributes' feature requires configuration of the Goldmark renderer.
|
||||||
|
See the Hugo [documentation](https://gohugo.io/content-management/markdown-attributes/) for more information.
|
||||||
|
|||||||
@@ -144,3 +144,27 @@ X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
|||||||
<kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd>を押すことでセッションを終了出来ます。
|
<kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd>を押すことでセッションを終了出来ます。
|
||||||
|
|
||||||
多くの<mark>サラマンダー</mark>は夜行性で、昆虫やミミズ、その他の生物を狩ります。
|
多くの<mark>サラマンダー</mark>は夜行性で、昆虫やミミズ、その他の生物を狩ります。
|
||||||
|
|
||||||
|
## Images
|
||||||
|
|
||||||
|
In addition to the [Figure Shortcode]({{< ref "../../docs/shortcodes#figure" >}}), you can define images using the following Markdown syntax:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can also leverage Hugos ['Markdown attributes'](https://gohugo.io/content-management/markdown-attributes/) feature to add custom attributes to the created HTML element.
|
||||||
|
For example, to set the width of an image to 50%:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
|
||||||
|
Note that the 'Markdown attributes' feature requires configuration of the Goldmark renderer.
|
||||||
|
See the Hugo [documentation](https://gohugo.io/content-management/markdown-attributes/) for more information.
|
||||||
|
|||||||
@@ -143,4 +143,28 @@ X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
|||||||
|
|
||||||
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
|
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
|
||||||
|
|
||||||
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
||||||
|
|
||||||
|
## Images
|
||||||
|
|
||||||
|
In addition to the [Figure Shortcode]({{< ref "../../docs/shortcodes#figure" >}}), you can define images using the following Markdown syntax:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can also leverage Hugos ['Markdown attributes'](https://gohugo.io/content-management/markdown-attributes/) feature to add custom attributes to the created HTML element.
|
||||||
|
For example, to set the width of an image to 50%:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
|
||||||
|
Note that the 'Markdown attributes' feature requires configuration of the Goldmark renderer.
|
||||||
|
See the Hugo [documentation](https://gohugo.io/content-management/markdown-attributes/) for more information.
|
||||||
|
|||||||
@@ -143,4 +143,28 @@ X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
|||||||
|
|
||||||
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
|
Press <kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd> to end the session.
|
||||||
|
|
||||||
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
||||||
|
|
||||||
|
## Images
|
||||||
|
|
||||||
|
In addition to the [Figure Shortcode]({{< ref "../../docs/shortcodes#figure" >}}), you can define images using the following Markdown syntax:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can also leverage Hugos ['Markdown attributes'](https://gohugo.io/content-management/markdown-attributes/) feature to add custom attributes to the created HTML element.
|
||||||
|
For example, to set the width of an image to 50%:
|
||||||
|
|
||||||
|
```md
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
{style="width:50%;"}
|
||||||
|
|
||||||
|
Note that the 'Markdown attributes' feature requires configuration of the Goldmark renderer.
|
||||||
|
See the Hugo [documentation](https://gohugo.io/content-management/markdown-attributes/) for more information.
|
||||||
|
|||||||
@@ -82,7 +82,12 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
<figure>
|
<figure
|
||||||
|
{{- range $k, $v := .Attributes -}}
|
||||||
|
{{- if $v -}}
|
||||||
|
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}>
|
||||||
{{- if $isRemote -}}
|
{{- if $isRemote -}}
|
||||||
{{- template "RenderImageSimple" (dict "imgObj" "" "src" $urlStr "alt" $altText) -}}
|
{{- template "RenderImageSimple" (dict "imgObj" "" "src" $urlStr "alt" $altText) -}}
|
||||||
{{- else if $resource -}}
|
{{- else if $resource -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user