Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

How to mix Markdown and Interact.jl?

$
0
0

I tried my first steps on WebIO + Interact.jl by

function app(req)
    mymarkdown = md"""
# Hello, Markdown!
## Lorem ipsum

* Point 1
* Point 2

Cauchy-Schwartz inequality:

$$\left(\sum_{k=1}^n a_k b_k \right)^2 \leq
  \left(\sum_{k=1}^n a_k^2 \right)  \left(\sum_{k=1}^n b_k^2 \right)$$"""

    el = @manipulate for A=0.1:0.2:3
        x=0:0.01:2*π;
        y=sin.(A*x);
        plot(x,y)
    end
    
    return Node(:div, Node(:div,pad(1em, mymarkdown)(background("#fff1f0"))),
                      Node(:div,pad(1em, el)(background("#fff1f0"))))
end

In Jupyter all looks perfectly.

Without the interact.jl code (variable el), the Markdown is rendered nicely even using webio_serve(page("/", app), 8000) by when adding el=@manipulate... it all formatting is lost.

Is there any WebIO or Interact.jl specialist here?

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles