Weave.jl: order of text and plots

Weaving a .jmd file like this within a ```julia code block:

println("line 1")
println("line 2")
display(plot(rand(10)))
println("line 3")
println("line 4")

gives this both in html and pdf output:

Is there a way to get plots appearing in the right place within a single code block?

Most simple solution I can think of:

```julia
println("line 1")
println("line 2")
```

```julia
display(plot(rand(10))
```

```julia
println("line 3")
println("line 4")
```

I believe with how Weave executes code blocks, HTML output is embedded after STDOUT. Not :100: sure on that one, but hope this helps @Marco-Congedo

Yeah, that works, but i would like to have all the code in a single code block…

I am rather unclear as to what your use case is for having all the code in a single code block. What are you exactly trying to achieve? What do you envision being in your final report? If your goal is to remove the code blocks in your report, one could do this to hide the code blocks:

```julia, echo = false
println("line 1")
println("line 2")
```

```julia, echo = false
display(plot(rand(10))
```

```julia, echo = false
println("line 3")
println("line 4")
```

In the end, it would look similar to I believe what you are trying to do.

What i am trying to do is to have .jl files, it does not matter how long they are, that can be included with a single line in a ```julia block located in the .jmd Weave file. For this to be effective, text and plots should output in the given order.

If that is achievable, it would be possible to weave a complex document with text and plots with a few lines of code in the .jmd file. Not sure this would be really useful though.