mitchelloharawild / icons Goto Github PK
View Code? Open in Web Editor NEWR package to easily insert web icons to RMarkdown
Home Page: https://pkg.mitchelloharawild.com/icons
R package to easily insert web icons to RMarkdown
Home Page: https://pkg.mitchelloharawild.com/icons
I've just updated an RMarkdown document that previously used the old style like icon::ii("social_github")
.
When used within a link, this used to work fine to create a linked icon:
[`r icon::ii("social_github")`](https://github.com/mitchelloharawild/icon)
but now
a) icon::ionicons()
does not seem to have an option for github icon or a twitter icon any more (nothing is found by find_icon()
), - I can use Simple icons instead, but...
b) the hyperlink is no longer rendered properly:
[`r icon::simple_icons("github")`](https://github.com/mitchelloharawild/icon)
renders with the literal brackets/braces and the URL visible, instead of creating a hyperlink.
Additionally, icon::migrate_icon("index.Rmd")
gives
Error: Not yet implemented.
Been eyeing this for a while. Include in icon
?
Hello,
Apologies in advance if this doesn't belong in here or has already been addressed (I couldn't find it on my onw)
I'm getting this error message:
'fontawesome' is not an exported object from 'namespace:icon'
Any comments or suggestions? Thank you,
When I use the download function to download any icons I get the following error message:
Error in basename(meta) : a character vector argument expected
This is the traceback output:
traceback()
3: stop(gettextf("'%s' is not an exported object from 'namespace:%s'",
name, getNamespaceName(ns)), call. = FALSE, domain = NA)
2: getExportedValue(pkg, name)
1: devtools::traceback
Any ideas why this error occurs?
my sessionInfo below:
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] flextable_0.6.0.010 data.table_1.13.6 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.3
[6] purrr_0.3.4 readr_1.3.1 tidyr_1.1.2 tibble_3.0.6 ggplot2_3.3.3
[11] tidyverse_1.3.0 RODBC_1.3-17 icon_0.2.0
loaded via a namespace (and not attached):
[1] httr_1.4.2 pkgload_1.1.0 jsonlite_1.7.2 modelr_0.1.8 assertthat_0.2.1 blob_1.2.1
[7] cellranger_1.1.0 remotes_2.2.0 sessioninfo_1.1.1 gdtools_0.2.2 pillar_1.4.7 backports_1.1.8
[13] lattice_0.20-41 glue_1.4.2 uuid_0.1-4 digest_0.6.27 rvest_0.3.6 colorspace_2.0-0
[19] htmltools_0.5.1.1 Matrix_1.2-18 pkgconfig_2.0.3 devtools_2.3.1 broom_0.7.4 haven_2.3.1
[25] scales_1.1.1 processx_3.4.5 officer_0.3.15 generics_0.1.0 usethis_1.6.1 ellipsis_0.3.1
[31] withr_2.4.1 cli_2.3.0 magrittr_2.0.1 crayon_1.4.0 readxl_1.3.1 memoise_1.1.0
[37] evaluate_0.14 ps_1.5.0 fs_1.5.0 fansi_0.4.2 xml2_1.3.2 pkgbuild_1.2.0
[43] tools_4.0.3 prettyunits_1.1.1 hms_0.5.3 lifecycle_0.2.0 munsell_0.5.0 reprex_0.3.0
[49] zip_2.1.1 callr_3.5.1 compiler_4.0.3 systemfonts_0.3.2 rlang_0.4.10 grid_4.0.3
[55] rstudioapi_0.13 rappdirs_0.3.3 base64enc_0.1-3 rmarkdown_2.6 testthat_3.0.1 gtable_0.3.0
[61] DBI_1.1.0 curl_4.3 R6_2.5.0 lubridate_1.7.9 knitr_1.31 utf8_1.1.4
[67] rprojroot_2.0.2 desc_1.2.0 stringi_1.5.3 Rcpp_1.0.6 vctrs_0.3.6 dbplyr_1.4.4
[73] tidyselect_1.1.0 xfun_0.20
Before release it would be great to check that icons work in non-standard locations including:
@apreshill has some examples where the font based implementation would work in tables.
A package named "ICON" was published on CRAN on 2019-12-06
. The repository for this package is here: https://github.com/rrrlw/ICON
Unfortunately this disallows submitting this package to CRAN under the {icon}
name, as per the CRAN policy.
Packages should be named in a way that does not conflict (irrespective of case) with any current or past CRAN package (the Archive area can be consulted), nor any current Bioconductor package. Package maintainers give the right to use that package name to CRAN when they submit, so the CRAN team may orphan a package and allow another maintainer to take it over.
When a new maintainer wishes to take over a package, this should be accompanied by the written agreement of the previous maintainer (unless the package has been formally orphaned).
https://cran.r-project.org/web/packages/policies.html#Source-packages
This conflict has arisen from two issues:
{icon}
package not being promptly submitted to CRAN.{ICON}
package not checking package name availability using available::available()
(https://r-pkgs.org/workflows101.html#use-the-available-package)The short {icon}
name is a design feature of the package, as the icon::library$name
interface is promoted and widely used. A change of package name is likely disruptive to many users.
I foresee three options (in no particular order) going forward:
{icon}
to CRAN (hasn't been on CRAN for >3 years, but this has caused installation troubles for new users. Much like {hadley/emo}
.){ICON}
package and submit {icon}
to CRAN (could be difficult with CRAN maintainers, and existing users of {ICON}
).{icon}
package (Alternative appropriate package names are in short supply... perhaps {icons}
?)If either package were to be renamed, this would inevitably cause disruption to the package's users.
Perhaps the {ICON}
maintainer @rrrlw could weigh in on the feasibility of changing {ICON}
name.
when i check the icon names in ii_iconList()
it doesn't match the names on the linked website for ionicons (https://ionicons.com/). also, many of the icons are not available. is there a way to sync the package with what's available on the website?
Using icons as masks for a word cloud is pretty cool. Currently you need to use rsvg::rsvg()
to format the icons appropriately for the mask
argument of ggwordcloud::geom_text_wordcloud_area()
. Some simpler function would be nice for this:
library(ggwordcloud)
#> Loading required package: ggplot2
set.seed(42)
ggplot(
love_words,
aes(
label = word, size = speakers,
color = speakers
)
) +
geom_text_wordcloud_area(
mask = rsvg::rsvg(charToRaw(format(icons::fontawesome$solid$hourglass))),
rm_outside = TRUE
) +
scale_size_area(max_size = 40) +
theme_minimal() +
scale_color_gradient(low = "darkred", high = "red")
#> Some words could not fit on page. They have been removed.
Created on 2021-03-12 by the reprex package (v0.3.0)
Can you give an example of how to stack icons, I can kind of see that stacking functionality has been added, but I can't see any examples of how to implement it.
Hi,
I used to integrate icon on xaringan presentation with for example the following syntax:
r icon::fa("r-project", size = 1, color = "#246ABE")
Since the new changes on the API discussed here (#31), I understood that I should use icon::fontawesome()
, however, the what is the appropriate syntax for the color and size argument? It is not specified in the doc and the arguments are no longer supported.
Could you please explain these changes for the customization of icons?
Thanks
Thank you very much for the package. Please add in the documentation (README) that if you want to use icons with compound words (name1-name2) you have to use single and not double quotes.
When we are looking for the icons with the icon_find()
function, to see how they are loaded in each icon library, the code shows them with inline chunk code, which is a bug.
icon_find("mouse-pointer")
#
fontawesome$solid$`mouse-pointer```
But really it should be done like this
#
fontawesome$solid$'mouse-pointer'``
Kindest regards
@mitchelloharawild nice work on the update and on your announcement tweet! ๐
Would you be interested in writing a short narrative as a tech note on rOpenSci blog?
Technically, here are other tech notes https://github.com/ropensci/roweb2/tree/master/content/technotes you'd submit your post as a Pull Request. Tech notes are not on a schedule so can be posted whenever. Your PR would be reviewed by an rOpenSci staff member (probably Stefanie cc-ed below). Tech notes are more or less short.
Ideally your post would present icon
with a screenshot like in your tweet and
You could also explain what the future development plans of icon
are (submission to CRAN? links to open issues in the repo in case help is welcome?), and well whatever you'd like to say about the package.
cc @stefaniebutland (rOpenSci community manager)
Hi @mitchelloharawild , first of all thank you very much for the package. I'm taking it for a xaringan presentation and at least fontawesome works great.
It just happens that when I make icon::download_academicons()
the following error appears.
Error: lexical error: invalid char in json text. NA (right here) ------^
Is it a problem of mine or a bug in the package?
Kindest Regards
Hello hello, I am wondering if there are plans to support HTML return values. Currently, if I understand correctly, the icon utilities create character strings whose class or classes coupled with the strings' values determine what icon glyphs are printed. Unfortunately, shiny interprets these values simply as strings.
I see the package's description specifically mentions usage in R markdown documents. Is there are any chance the API could be extended to support usage in shiny applications? I am willing to put together a PR if shiny support is within the bounds of the package.
Maybe it's just me, but this doesn't seem like the right output
fa_birthday_cake()
#> [1] "fa:xbox"
icon::fa("birthday_cake")
produces the appropriate "fa:birthday_cake"
.
None of these render, but that's very likely my setup.
Shiny apps and other services require the icons cached. As the downloading process may take substantial time, this downloading should only happen once per server.
Some tools for easily deploying apps with icons would be helpful.
Hello!
I feel like we have talked about this in the past, so my apologies if this has already been solved.
When I have a xaringan presentation with YAML like so:
---
title: title
author: me
date: "<div class='medium'>Event, <br><br> `r icons::fontawesome(name = 'link', 'solid')` **bit.ly/LINK** <br><br> `r icons::fontawesome$brands$twitter` **HANLDE**</div>"
output:
xaringan::moon_reader:
lib_dir: libs
css:
- njtheme.css
- extra.css
- animate.css
- typewriter.css
nature:
ratio: "16:9"
titleSlideClass: ["left", "middle", "inverse"]
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
slideNumberFormat: "%current%"
---
When I knit the presentation I get
output file: index.knit.md
Error in yaml::yaml.load(..., eval.expr = TRUE) :
Parser error: while parsing a block mapping at line 1, column 1 did not find expected key at line 3, column 61
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous>
Execution halted
I was wondering if there is a workaround for this?
When using a custom css file with xaringan
, icons do not render for me, only the code gets printed.
Everything works fine with the default xaringan
template. Anything crucial that is missing in my custom css? [Its quite large so I would only post it if it really helps)
Only for icons of length 1, icon_explode()
/icon_unstack()
will split an icon into multiple icons by their paths. icon_stack()
is used to combine icons or rebuild an unstacked icon.
Greetings,
Great package, thanks for your contribution.
I am able to get many of the icons listed but ideas-repec that is listed in your link to academicons appears to be missing icon::ai("ideas-repec")
. It would be great to have this functionality added if it is no too much trouble.
Thanks!
As of the 4.0.0 update, Google removed package.json
from the GitHub repository and this causes download_material_design()
to fail as follows:
> icon::download_material_design()
Error in open.connection(con, "rb") :
cannot open the connection to 'https://raw.githubusercontent.com/google/material-design-icons/master/package.json'
In addition: Warning message:
In open.connection(con, "rb") :
cannot open URL 'https://raw.githubusercontent.com/google/material-design-icons/master/package.json': HTTP status was '404 Not Found'
Looks like the download function only uses the json to capture version and license for Material design in the following:
meta <- jsonlite::read_json("https://raw.githubusercontent.com/google/material-design-icons/master/package.json")
install_icon_zip("material_design", url, svg_path = mdi_svg_paths,
svg_pattern = "_48px\\.svg", svg_dest = mdi_svg_dest,
meta = list(name = "Material Design Icons", version = meta$version, licence = meta$license))
One way to assign version would be to use the gh
package which I do recognize introduces a (lightweight) dependency, but a line to do that is here:
gh::gh("GET /repos/{owner}/{repo}/releases/latest", owner="google", repo="material-design-icons")$tag_name
Conveniently, the same thing will work for license:
gh::gh("GET /repos/{owner}/{repo}", owner="google", repo="material-design-icons")$license$name
contains the R icon ๐
MRE:
fontawesome$solid$rocket
icon_style(fontawesome$solid$rocket, rotate = 90)
Since the recent update, I seem to have an issue with academicons icons, which basically do not render. I'm using icon
in conjunction with xaringan
--- the previous syntax
`r icon::ai("pubmed")`
would work perfectly. But when I use the new syntax, nothing really shows up... The code works for fontawesome
icons, so for instance, something like
`r icon::fontawesome("r-project")`
adds the R
logo. But no academicons
icon is rendered.
Just for completeness, I've also tested this here. If I add to the original html
code the element
<svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;fill:currentColor;position:relative;display:inline-block;top:.1em;">
[ comment ]
<path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path>
</svg>
(which is the output of icon::fontawesome("r-project")
), then the R
logo is rendered.
But if I add to the html
code
<svg xmlns="http://www.w3.org/2000/svg" style="height:1em;fill:currentColor;position:relative;display:inline-block;top:.1em;">
<path transform="scale(1,-1) translate(0,-448)" d="M120.192 270.263h0.000976563s49.7627 140.605 245.478 -1.97754c0 -51.3457 -0.376953 -206.691 -0.376953 -268.285c-212.277 179.855 -248.861 26.4814 -248.861 26.4814c0 95.8271 -98.1035 84.4092 -98.1035 84.4092v255.18s22.5059 -1.68164 45.9482 -13.333 v31.2627s58.9102 -13.3506 55.915 -113.737zM307.399 96.4414h-0.000976562h44.1396l-25.6816 169.619h-43.875l-36.4658 -90.6494l-34.4355 90.6494h-43.4268l-28.8018 -169.619h43.875l14.1758 97.6543h0.448242l38.9365 -97.6543h17.5596l40.7285 97.6543h0.448242z"></path>
</svg>
(the output of icon::academicons("pubmed")
), nothing shows up.
I notice that the two output differ because the one produced from academicons
misses the
[ comment ]
bit --- could this be the problem? (I don't know much about how svg
are created/coded up, so this may be totally irrelevant...).
Apologies if I'm missing something obvious & thanks for your help!
Gianluca
Hi,
Thanks for the great package!
I've noticed a weird error: inserting emojis (direcly or using the emo
package) seems to cause future icons to break.
See e.g. the attached markdown source and result.
icon_reprex.zip
Any ideas why this is happening? I can't figure it out!
๐ @mitchelloharawild! I've started using your new package in a slidedeck, nice work!
Shouldn't this repo here be archived? Before doing that I'd recommend making the README a minimal README with a moved status badge and a few lines about where to find the new API.
There's a good chance I'm doing something wrong, but I can't get this to work at all.
---
title: "Testing icon"
author: "Jonathan Carroll"
date: "10 November 2017"
output:
pdf_document: default
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Testing `icon`
`r icon::fa("birthday_cake")`
```{r}
icon::fa("birthday_cake")
```
renders to
and
I have fonts-font-awesome
installed (4.5.0~dfsg-1).
Any hints?
Hi - really great work on this package! I was wondering if you had considered adding support for feather icons?
Thank you for this great package.
Previously, I was able to install the package using remotes::install_github("mitchelloharawild/icons")
but after I upgrade R, I could not install it. Please kindly suggest how to fix it.
Thanks
Here is the error message
*** installing help indices
converting help for package 'icons'
finding HTML links ... done
academicons html
feather_icons html
fontawesome html
google_material html
icon_find html
icon_installed html
icon_save html
icon_set html
icon_style html
icons-package html
ionicons html
migration html
octicons html
read_icon html
simple_icons html
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'icons':
.onAttach failed in attachNamespace() for 'icons', details:
call: NULL
error: invalid version specification 'v4.28.0'
Error: loading failed
Execution halted
*** arch - x64
Error: package or namespace load failed for 'icons':
.onAttach failed in attachNamespace() for 'icons', details:
call: NULL
error: invalid version specification 'v4.28.0'
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
like xaringan
which runs servr
in an interactive R session in RStudio.
This causes icons not to be rendered. Instead the only the name is returned.
Is there any value in returning the name at all?
I removed the interactive condition and it works fine with xaringan
.
As its one of the most used presentation libraries in R, it would be great if it could be supported!
Maybe there is even a simpler way to suppress the interactiveness of the server? cc @yihui
Cross-ref: https://github.com/earowang
https://github.com/ropenscilabs/icon/blob/993fc64a9d06758997f8458d06827f175e4144df/R/fa.R#L65-L66
cc: @earowang, @emitanaka
Rewrite of the interface to introduce support for user defined icon libraries, and extensibility support (hopefully improving anicon). Along with the rewrite, the package will convert from icon fonts to SVG icons.
I imagine that anicon may be better suited as a general purpose animation library for rmarkdown documents. This is something I'd like to work on later this month.
modify(icon, colour = "red", rotate = 90)
icon1 + icon2
animate(icon, animation)
my_icon <- new_icon(svgfolder)
my_icon$icon_name(...)
my_icon(icon_name)
$
methodsmy_icon <- structure(function(...){
return(..1)
}, class = "icon")
`$.icon` <- function(lib, icon){
return(deparse(icon))
}
my_icon$rocket
my_icon("rocket")
Hi there,
it's not really in issue in the classical sense but I just wanted to propose creating a separate repository "mitchelloharawild/icon" containing the old icons package. There are some packages that depend on the "icon" package. Due to the name change installing "icon" leads to an error message now (see nstrayer/datadrivencv#57).
Ideally, the old package itself would tell the users about its deprecation.
Just a suggestion. Since I do not expect all packages depending on "icon" to merge fixes soon my current workaround is to install v.1.0.1. manually:
remotes::install_github('mitchelloharawild/[email protected]')
Anyway, thanks for this wonderful package .
BerriJ
Page : https://yagizcanerdogan.github.io/budgetapplicationv1/
If you press f12 for console you can see the error saying "http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" is blocked
I think I have found a small bug (in your fancy package). Minimal example to reproduce:
---
title: "Untitled"
output: ioslides_presentation
---
## R Markdown `r icon::fa("rocket")`
This is an R Markdown presentation.
This leads to a strange ">
line in the first line of the slide.
In the previous version, we could set animate = spin
as a new style for the icon. Is this still possible?
Here is my code:
icon_style(fontawesome("cog", style = "solid"), size = 1, animate = "spin", color = "white")
Thanks a lot for your package!
Hi, I am trying to use it in RMarkdown and preview the html file through https://htmlpreview.github.io/. The icons work just fine on my local computer but didn't show in the browser. Could you help me with solving this issue? Thank you!
Invite users to download icons with download_*()
.
Hi!
I was playing around in Icon to spice up some less serious reports. Inside text blocks it looks magnificent, but when I tried to use an icon inside an Rmarkdown title, the end result looked a bit funny.
It added some text in front of the title: -title" class="section level1">
The issue did not go away when I added some text before the inline code
Any suggestions on how to fix this?
Thanks!
See e.g. https://fontawesome.com/license
The function I have in mind would look for all icon
calls in the RMarkdown and output text corresponding to licence of the sources. Then if I say make a poster with RMarkdown and icon
, I'd call this function in a chunk to have legal stuff at the bottom.
Thanks @stephlocke for the idea.
I've tried to update to fontawesome 5.2.0... it works but it's not elegant. I think I've included more fontawesome code than necessary so I didn't suggest it as a direct pull request.
It can be found here: https://github.com/garthtarr/icon
Doesn't take very long to do, but there are a few extra icons available in 5.2.0 that aren't currently accessible with the icon package, would be great to see it officially supported.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.