From a49111afe0e8bebca1b373e0350222e14da5730e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Sat, 26 Jun 2021 18:32:03 +0200 Subject: [PATCH] Update Kino introductory notebook with Markdown output (#406) --- .../notebook/explore/intro_to_kino.livemd | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/livebook/notebook/explore/intro_to_kino.livemd b/lib/livebook/notebook/explore/intro_to_kino.livemd index 2a3413e46..a18174711 100644 --- a/lib/livebook/notebook/explore/intro_to_kino.livemd +++ b/lib/livebook/notebook/explore/intro_to_kino.livemd @@ -10,7 +10,7 @@ and interact with it. ```elixir Mix.install([ - {:kino, "~> 0.2.0"}, + {:kino, "~> 0.2.1"}, {:vega_lite, "~> 0.1.0"} ]) ``` @@ -149,6 +149,33 @@ Kino.DataTable.new( We can sort by the number of reductions to identify the most busy processes! +## Kino.Markdown + +Sometimes you may want to render arbitrary content as rich-text, +that's when `Kino.Markdown.new/1` comes into play: + +```elixir +""" +# Example + +A regular Markdown file. + +## Code + +```elixir +"Elixir" |> String.graphemes() |> Enum.frequencies() +``` + +## Table + +| ID | Name | Website | +| -- | ------ | ----------------------- | +| 1 | Elixir | https://elixir-lang.org | +| 2 | Erlang | https://www.erlang.org | +""" +|> Kino.Markdown.new() +``` + ## Kino.render/1 As we saw, Livebook automatically recognises widgets returned