diff --git a/assets/js/hooks/markdown_renderer.js b/assets/js/hooks/markdown_renderer.js index 3434523da..532f333c7 100644 --- a/assets/js/hooks/markdown_renderer.js +++ b/assets/js/hooks/markdown_renderer.js @@ -13,7 +13,9 @@ const MarkdownRenderer = { mounted() { this.props = this.getProps(); - const markdown = new Markdown(this.el, ""); + const markdown = new Markdown(this.el, "", { + baseUrl: this.props.sessionPath, + }); this.handleEvent( `markdown_renderer:${this.props.id}:content`, @@ -26,6 +28,7 @@ const MarkdownRenderer = { getProps() { return { id: getAttributeOrThrow(this.el, "data-id"), + sessionPath: getAttributeOrThrow(this.el, "data-session-path"), }; }, }; diff --git a/lib/livebook_web/live/output.ex b/lib/livebook_web/live/output.ex index e33d392e3..c8a81fd59 100644 --- a/lib/livebook_web/live/output.ex +++ b/lib/livebook_web/live/output.ex @@ -47,8 +47,12 @@ defmodule LivebookWeb.Output do """ end - defp render_output({:markdown, markdown}, %{id: id}) do - live_component(Output.MarkdownComponent, id: id, content: markdown) + defp render_output({:markdown, markdown}, %{id: id, session_id: session_id}) do + live_component(Output.MarkdownComponent, + id: id, + session_id: session_id, + content: markdown + ) end defp render_output({:image, content, mime_type}, %{id: id}) do diff --git a/lib/livebook_web/live/output/markdown_component.ex b/lib/livebook_web/live/output/markdown_component.ex index 70d56e2d5..6160d3541 100644 --- a/lib/livebook_web/live/output/markdown_component.ex +++ b/lib/livebook_web/live/output/markdown_component.ex @@ -17,7 +17,8 @@ defmodule LivebookWeb.Output.MarkdownComponent do