Giter Site home page Giter Site logo

Comments (5)

cderv avatar cderv commented on June 17, 2024 1

Which means I may have wasted your time somewhat here.

Time is not wasted. Always happy to help, and I think I should warn and ignore or error differently than it is today when not in rmarkdown.

If I can figure out a minimal reprex for this failure I'll post it as an issue for {rmarkdown} directly.

Yes please do. There may already be some threads with rendering in iteration. It is possible that this is safer to wrap the render() call with callr so that it happens in background fresh session for each iteration.

from fontawesome.

cderv avatar cderv commented on June 17, 2024

Current implementation does not support knitr::knit() directly. If you try with rmarkdown::render(), this is working right ?

The method would need to be adjusted but currently markdown output is not supported to include icons.

knitr::knit()-ing a Rmd will output to .md file - there is no hint on the output format. (The YAML header you provide in Rmd is for rmarkdown)
Not sure what we should output in that case. We handle gfm format by including svg but no other markdown variant is supported, and no icon will be included.

Can you tell more about your use case for knitr::knit() instead of rmarkdown::render() ? What would be your expected output in the markdown file ?

from fontawesome.

charliejhadley avatar charliejhadley commented on June 17, 2024

My use case for knitr::knit() is an edge case.

I have many .Rmd to programmatically run, a fair few of these have issues that prevent rmarkdown::render() from working. Those are harder to diagnose/fix. I looked at knitr::knit() as an alternative as fewer .Rmd failed in that direction, and the issue turned out to be this which I could diagnose and turn into a reprex.

Here's a real-world example of an .Rmd with this issue

---
title: "Untitled"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(fontawesome)
colours_ggplot2_components <- as.list(setNames(ggpomological:::pomological_palette[1:5], c("aesthetics", "geoms", "scales", "guides", "themes")))
```

- `r fa(name = "ruler-combined", fill = colours_ggplot2_components$aesthetics)` <span style='color:`r colours_ggplot2_components$aesthetics`'>Aesthetics</span>

- `r fa(name = "shapes", fill = colours_ggplot2_components$geoms)` <span style='color:`r colours_ggplot2_components$geoms`'>Geoms</span>

- `r fa(name = "balance-scale", fill = colours_ggplot2_components$scales)` <span style='color:`r colours_ggplot2_components$scales`'>Scales</span>

- `r fa(name = "tags", fill = colours_ggplot2_components$guides)` <span style='color:`r colours_ggplot2_components$guides`'>Guides</span>

- `r fa(name = "paint-roller", fill = colours_ggplot2_components$themes)` <span style='color:`r colours_ggplot2_components$themes`'>Theme</span>

When rmarkdown::render() is used the output looks like this

image

from fontawesome.

cderv avatar cderv commented on June 17, 2024

Yes currently fontawesome will only output some icons when used with rmarkdown. When using knit() on a .Rmd the output is an .md file and we can't assume by default that icons should be included with HTML output in mind in a later step.

What would you expect as content in the result from your knitr::knit() step ? What is your workflow for those special Rmd files ?

I would prefer to fix the issue why those files don't support rmarkdown::render(). rmarkdown will do a lot of default setting for knitr so you can"t expect to have the same type of output by calling knitr::knit() yourself. But you may already know that 😅

Regarding this issue, I am currently thinking of correctly ignoring the icons when an output format is not defined (meaning rmarkdown / Pandoc is not used).

Inline chunk does not take options so I am not sure we could make a special behavior.

I am really interested of what output your wish as a result of knitr::knit("my.Rmd")

from fontawesome.

charliejhadley avatar charliejhadley commented on June 17, 2024

Ah, I didn't already know this. I inherited a script that was attempting to do knitr::knit() and pushed on with that without really thinking that I was generating .md files instead of what the YAML specified the output format as.

Which means I may have wasted your time somewhat here. The issues I was having with rmarkdown::render() only appear when I'm attempting to purrr::walk() over a collection of .Rmd files and weren't connected {fontawesome}. If I can figure out a minimal reprex for this failure I'll post it as an issue for {rmarkdown} directly.

from fontawesome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.