quarto-ext / fontawesome

Use Font Awesome icons in HTML and PDF documents.
MIT License
97 stars 11 forks source link

Support Icon Sizes? #4

Closed B0ydT closed 1 year ago

B0ydT commented 2 years ago

Hi team,

Thanks for this package, it has a lot of icons that I want that bootstrap doesn't include. Now that I've added some to my nav bar I notice they are smaller than the bootstrap icons, and I can't find a neat way to resize just those icons (although my css style knowledge is nonexistent).

Is adding support for icon sizes (https://fontawesome.com/docs/web/style/size) on the cards/consistent with the aims of the extension? Or is there a better alternative I'm unaware of?

I think it could be parsed in a very similar way as to what you just added for fa-brands, and I'd be willing to take a crack at a pull-request as long as I know the functionality is actually desired.

The only technical challenge I see is figuring out whether a two-argument shortcode contains a group and icon, or an icon and scale, but I think it would be easy to write regex to detect a scale.

mcanouil commented 1 year ago

It's possible to add some arguments to the lua filter with some default as it was done for the solid/brands groups. https://github.com/quarto-ext/fontawesome/blob/bb9eaa844dbcc847a1e186f9b08b6a64ad2d0d44/_extensions/fontawesome/fontawesome.lua#L16-L21 https://github.com/quarto-ext/fontawesome/blob/bb9eaa844dbcc847a1e186f9b08b6a64ad2d0d44/_extensions/fontawesome/fontawesome.lua#L26

PS: I'll probably make a PR later (if not done by then by someone else).

mcanouil commented 1 year ago

I added a named argument size to allow relative and literal sizing as described on FA docs. This way it does not interfere or change the previous shortcode behaviour. To note: the size option (as the group option) is useless for PDF.

image

See #10

B0ydT commented 1 year ago

Thanks, I really like this. I had mocked up an implementation that didn't require a named argument, but the pattern matching required was a bit unwieldy.