Skip to content

Lint: warn when knitr classes are used (was: use plot as blog post image) #8804

Open

Description

@produnis

Hi there,
I am using (quarto 1.4.550), and my problem is that #| class-output: preview-image seems to be ignored. Please find a working example at https://github.com/produnis/testing and have a look at the "Welcome" post. Instead of the first Anscombe plot, the Datasaurus was ment to be used as the preview pic....

Greetings, Joe

Originally posted by @produnis in #2324 (comment)

Activity

  1. self-assigned this
    on Feb 21, 2024
  2. added this to the v1.5 milestone on Feb 21, 2024
  3. dragonstyle commented on Feb 21, 2024

    @dragonstyle
    Collaborator

    The issue is that your code cell should be using classes - e.g.:

    ```{r}
    #| label: fig-datasaurus
    #| classes: preview-image # <- Note classes name
    #| fig-width: 8
    #| fig-height: 8
    library(ggplot2)
    load(url("https://www.produnis.de/nagut/datasaurus.RData"))
    
    datasaurus |> 
      ggplot(aes(x=x, y=y)) +
      geom_point() +
      facet_wrap(~dataset)
    ```
    

    HTH!

  4. added
    support
    on Feb 21, 2024
  5. cderv commented on Feb 21, 2024

    @cderv
    Member

    As I see you are using #| class-output: preview-image, just a mention that this is the knitr options for text output block: https://yihui.org/knitr/options/#text-output

    Different from classes which applies on cell container more globally (https://quarto.org/docs/reference/cells/cells-knitr.html#attributes)

  6. produnis commented on Feb 21, 2024

    @produnis
    Author

    thanks for your answer....
    so, the problem was 30cm next to the monitor... :/

    using #| classes: preview-image instead of #| class-output: preview-image it works!

  7. dragonstyle commented on Feb 21, 2024

    @dragonstyle
    Collaborator

    It was super helpful that you included the source file - made it easy to see the problem rather than try to stumble through. Thank you!!!

  8. added
    lint
    on Feb 21, 2024
  9. modified the milestones: v1.5, Future on Feb 21, 2024
  10. changed the title [-]use plot as blog post image[/-] [+]Lint: warn when knitr classes are used (was: use plot as blog post image)[/+] on Feb 21, 2024
  11. cscheid commented on Feb 21, 2024

    @cscheid
    Member

    I'm going to reopen this and file it for our future linter.

  12. added
    enhancement
    and removed
    support
    on Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementlint

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions