Pagedown: Specify icon for section title

Created on 2 Feb 2019  路  4Comments  路  Source: rstudio/pagedown

I understand that I can get an icon by<i class="fas fa-brain"></i>. What if I want to add an icon to the title? I tried "{data-icon="fa-table"}" from https://bookdown.org/yihui/rmarkdown/layout.html, no icon shows up

Most helpful comment

I did have some trouble when trying to add an icon to a lower level heading, as the new icon collides with the default icon. So hopefully it's useful to mention that in these cases an explicit "data-icon=NULL" is needed. E.g.

<i class="fas fa-book"></i> Publications {data-icon=NULL}
--------------------------------------------------------------------------------

All 4 comments

I succeded to add an icon to the title resume by inserting it here: https://github.com/rstudio/pagedown/blob/2b46119f4a882aaa3b39e63229b0ce67d0a38f3e/inst/rmarkdown/templates/html-resume/skeleton/skeleton.Rmd#L49

For instance,

Main
================================================================================

<i class="fas fa-table"></i> Lijia Yu {#title}
--------------------------------------------------------------------------------

In your question, you mention the brain fa icon. This icon was introduced in Font Awesome 5.2.0 (see https://fontawesome.com/icons/brain and https://github.com/FortAwesome/Font-Awesome/commit/03bcd4dc0831f0651a3b5a7cd41153e8129fccf3)
The pagedown package uses the Font Awesome icons bundled by the rmarkdown package.
The rmarkdown Font Awesome version is 5.1.0 and therefore, does not contain the brain icon.

You can check the rmarkdown fa version with:

rmarkdown::html_dependency_font_awesome()$version

thank you

I did have some trouble when trying to add an icon to a lower level heading, as the new icon collides with the default icon. So hopefully it's useful to mention that in these cases an explicit "data-icon=NULL" is needed. E.g.

<i class="fas fa-book"></i> Publications {data-icon=NULL}
--------------------------------------------------------------------------------

@Tazinho That sounds reasonable. Would you file a new issue for that? Thanks!

Was this page helpful?
0 / 5 - 0 ratings