spring-io / spring-asciidoctor-backends

A backend for Asciidoctor used to produce Spring styled HTML
Apache License 2.0
80 stars 16 forks source link

FontAwesome icons not rendered correctly #65

Closed odrotbohm closed 2 years ago

odrotbohm commented 2 years ago

In contrast to the standard HTML backend, our generated documents are missing the directive to include the FontAwesome icon CSS file

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

There's code that sets the icons to be font-based by default, but also deactivates remote fonts (a line below). If we really want the latter, we'd have to ship FontAwesome CSS and fonts ourselves.

philwebb commented 2 years ago

Setting icons to font might be an oversight in our CSS. I can't remember why we did it, it might have been to get HTML markup that was easier to style even though we don't directly use font-awsome. For the limited "icons" that we do use, we have a single octicons-16.svg file.

Are you wanting to use font-awesome directly in markup? Or are you finding one of the existing admon icons isn't correct?

odrotbohm commented 2 years ago

Yes, the sources I deal with contain icon:folder[] expressions that render fine when using the standard HTML backend.

philwebb commented 2 years ago

I remember a bit more about why the font support is so odd. The CSS for this backend is based on Antora and they don't currently have support for font-awesome. We use the :icons: font attribute to generate CSS we can use, but actually implement fa CSS class by loading images from an SVG file.

I've got something hacked locally that reinstates font-awsome 4 support but I need to do some more testing before it can be merged.

odrotbohm commented 2 years ago

Thanks for the update, Phil! Happy to give some snapshots a spin if that helps.

philwebb commented 2 years ago

@odrotbohm I've pushed something, but you'll need to set a :iconfont-fontawesome: attribute to enable the feature. Let me know if it doesn't work.

odrotbohm commented 2 years ago

I can confirm this works as described! Thanks, Phil! 🙇