Skip to content

knitr/quarto rendering does not capture certain Julia output with user-defined show method #250

Open
@paciorek

Description

@paciorek

I'm having some Julia output not captured in the generated document by knitr/quarto, which makes me think there might be something that needs to be fixed in terms of capturing certain output from Julia.

Here's my qmd content:

---
title: test
engine: knitr
---

```{julia}
struct test
  x
end

function Base.show(io::IO, x::test)
  println("hello")
end

y = test("foo");
y

z = 35;
z
```

In my rendered output (either from knit2html("test.qmd") or quarto render test.qmd), I do not see "hello" in the rendered output, which should be printed out when invoking y. But I do see 35 from invoking z, which makes it seem like certain output from Julia is treated differently because of my user-defined show method.

Instead "hello" is printed to the (R or bash) console during the rendering process:

> knitr::knit2html("test.qmd")


processing file: test.qmd
  |....................................................| 100% [unnamed-chunk-1]hello
                                                                                                           
output file: test.md

I think this may relate to issue #76.

This is with R 4.4.0 and JuliaCall 0.17.6 and knitr 1.46 or 1.48, under both MacOS and Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions