livebook/lib/livebook_web/live/output/markdown_static_component.ex
Sergey Kuznetsov 99ea48ae9d
Add 'Render ... Markdown blocks' option to published apps
> Disclaimer: it's a proof-of-a-concept for an idea discussion.

It's an attempt to introduce a "Render ... Markdown blocks" feature to
the published apps as an option. It shall consider to render markdown
block from the original notebook as an addition to the evaluable cells.

Due to the limited understanding of how app rendering pipeline works,
this commit should be considered only as a proof-of-a-concept, that most
likely will be reworked fully.

P.S. Eventually, it should also take image and section titles cells and
render them.
2025-03-29 23:30:06 +01:00

12 lines
277 B
Elixir

defmodule LivebookWeb.Output.MarkdownStaticComponent do
use LivebookWeb, :live_component
@impl true
def render(assigns) do
~H"""
<div>{to_html(@output.text)}</div>
"""
end
defp to_html(markdown), do: Earmark.as_html!(markdown) |> Phoenix.HTML.raw()
end