quarto-ext / fontawesome

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

feature request: turn on linking without using shortcodes #30

Open EmilHvitfeldt opened 1 year ago

EmilHvitfeldt commented 1 year ago

Sometimes I find myself using font awesome without need or ability to use short codes. E.i. programmatically constructed content.

I can turn on the linking with <div style="display:none;">{{< fa thumbs-up >}}</div> but that isn't super neat. without looking at the internals, being able to do something << fa activate=true >> would be nice way to link the files without adding an icon in the process

cscheid commented 1 year ago

How is your programmatically-constructed content being created? Is it in Lua? In that case,

  quarto.doc.add_html_dependency({
    name = 'fontawesome6',
    version = '0.1.0',
    stylesheets = {'assets/css/all.css', 'assets/css/latex-fontsize.css'}
  })

should work. That's a bit of a hack, but it's what ensureHtmlDeps() does here: https://github.com/quarto-ext/fontawesome/blob/main/_extensions/fontawesome/fontawesome.lua

We don't want to do this to every project that declares this extension (for hopefully obvious reasons), but I agree that there should be a way to do it, including possibly a YAML header option..

EmilHvitfeldt commented 1 year ago

latest example was when trying to add icons using css.

// this comes from the fontawesome docs: https://fontawesome.com/docs/web/setup/upgrade/pseudo-elements
.icon::before {
  display: inline-block;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

.reveal .live-code {
  h2::before {
      font-family: FontAwesome;
      content: "\f0e7";
      display: inline-block;
    }
}
cscheid commented 1 year ago

Yeah, I think that the right way for us to do this, then, is to also embed a new filter that checks the document metadata and does the inclusion when requested.

r-leyshon commented 11 months ago

How is your programmatically-constructed content being created? Is it in Lua? In that case,

  quarto.doc.add_html_dependency({
    name = 'fontawesome6',
    version = '0.1.0',
    stylesheets = {'assets/css/all.css', 'assets/css/latex-fontsize.css'}
  })

should work. That's a bit of a hack, but it's what ensureHtmlDeps() does here: https://github.com/quarto-ext/fontawesome/blob/main/_extensions/fontawesome/fontawesome.lua

We don't want to do this to every project that declares this extension (for hopefully obvious reasons), but I agree that there should be a way to do it, including possibly a YAML header option..

+1 for YAML option to declare a fontawesome requirement in a doc or all pages in a website in the _quarto.yml