Skip to content

Commit f77b0d4

Browse files
authored
fix: Allow to set/unset inline attribute (#32)
1 parent 3fb92cf commit f77b0d4

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ You can browse all of the available sets of icons here:
4040
### Iconify Attributes
4141

4242
Iconify API provides additional attributes: <https://docs.iconify.design/iconify-icon/>.
43-
Currently, this extension supports: `width`, `height`, `title`[^2], `label`[^2] (_i.e._, `aria-label`), `flip`, and `rotate`.
43+
Currently, this extension supports: `size`, `width`, `height`, `flip`, `rotate`, `title`[^2], `label`[^2] (_i.e._, `aria-label`), and `inline`[^3].
4444

4545
``` markdown
46-
{{< iconify <set> <icon> <size=...> <width=...> <height=...> <flip=...> <rotate=...> <title=...> <label=...> >}}
47-
{{< iconify <set:icon> <size=...> <width=...> <height=...> <flip=...> <rotate=...> <title=...> <label=...> >}}
46+
{{< iconify <set> <icon> <size=...> <width=...> <height=...> <flip=...> <rotate=...> <title=...> <label=...> <inline=...> >}}
47+
{{< iconify <set:icon> <size=...> <width=...> <height=...> <flip=...> <rotate=...> <title=...> <label=...> <inline=...> >}}
4848
```
4949

5050
[^2]: `title` and `label` takes the following default value: `Icon <icon> from <set> Iconify.design set.`.
51+
[^3]: `inline` is a boolean attribute that can be set to `true` or `false`. Default is `true`.
5152

5253
### Sizing Icons
5354

_extensions/iconify/_extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Iconify support
22
author: Mickaël Canouil
3-
version: 2.1.1
3+
version: 2.1.2
44
quarto-required: ">=1.2.280"
55
contributes:
66
shortcodes:

_extensions/iconify/iconify.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,15 @@ return {
139139
attributes = attributes .. ' rotate="' .. rotate .. '"'
140140
end
141141

142+
local inline = pandoc.utils.stringify(kwargs["inline"])
143+
if is_empty(inline) or inline ~= "false" then
144+
attributes = ' inline ' .. attributes
145+
end
146+
147+
142148
return pandoc.RawInline(
143149
'html',
144-
'<iconify-icon inline=true role="img"' .. attributes .. '></iconify-icon>'
150+
'<iconify-icon role="img"' .. attributes .. '></iconify-icon>'
145151
)
146152
else
147153
return pandoc.Null()

example.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ It provides an `{{{< iconify >}}}` shortcode:
1212
{{{< iconify <set:icon> >}}}
1313
```
1414

15-
- Optional `<set>` (default is `fluent-emoji`) `<size=...>`, `<width=...>`, `<height=...>`, `<flip=...>`, and `<rotate=...>`:
15+
- Optional `<set>` (default is `fluent-emoji`) `<size=...>`, `<width=...>`, `<height=...>`, `<flip=...>`, `<rotate=...>`, `<title=...>`, `<label=...>`, and `<inline=...>`:
1616
``` markdown
17-
{{{< iconify <set> <icon> <size=...> <width=...> <height=...> <flip=...> <rotate=...> >}}}
17+
{{{< iconify <set> <icon> <size=...> <width=...> <height=...> <flip=...> <rotate=...> <title=...> <label=...> <inline=...> >}}}
1818
```
1919
If `<size=...>` is defined, `<width=...>` and `<height=...>` are not used.
2020
See <https://docs.iconify.design/iconify-icon/> for more details.

0 commit comments

Comments
 (0)