diff --git a/assets/css/utilities.css b/assets/css/utilities.css index a09f6d865..facee093b 100644 --- a/assets/css/utilities.css +++ b/assets/css/utilities.css @@ -22,4 +22,8 @@ .flip-horizontally { transform: scaleY(-1); } + + .scroll-smooth { + scroll-behavior: smooth; + } } diff --git a/assets/js/cell/markdown.js b/assets/js/cell/markdown.js index 20a572399..08bb37be9 100644 --- a/assets/js/cell/markdown.js +++ b/assets/js/cell/markdown.js @@ -126,7 +126,7 @@ function remarkExpandUrls(options) { return (ast) => { if (options.baseUrl) { visit(ast, "link", (node) => { - if (node.url && !isAbsoluteUrl(node.url)) { + if (node.url && !isAbsoluteUrl(node.url) && !isPageAnchor(node.url)) { node.url = urlAppend(options.baseUrl, node.url); } }); @@ -161,7 +161,7 @@ function rehypeExternalLinks(options) { if (isInternalUrl(url)) { node.properties["data-phx-link"] = "redirect"; node.properties["data-phx-link-state"] = "push"; - } else { + } else if (isAbsoluteUrl(url)) { node.properties.target = "_blank"; node.properties.rel = "noreferrer noopener"; } @@ -174,6 +174,10 @@ function isAbsoluteUrl(url) { return url.startsWith("http") || url.startsWith("/"); } +function isPageAnchor(url) { + return url.startsWith("#"); +} + function isInternalUrl(url) { return url.startsWith("/") || url.startsWith(window.location.origin); } diff --git a/lib/livebook_web/live/session_live.ex b/lib/livebook_web/live/session_live.ex index 5ee5fe4f9..a8ba9e057 100644 --- a/lib/livebook_web/live/session_live.ex +++ b/lib/livebook_web/live/session_live.ex @@ -114,13 +114,13 @@ defmodule LivebookWeb.SessionLive do
-
-

+
+

Sections

-
+
<%= for section_item <- @data_view.sections_items do %> - <% end %>
-
-
-
-

+
+
+

Users

- - + + <%= length(@data_view.clients) %> connected
-
+
<%= for {client_pid, user} <- @data_view.clients do %>
- <%= if client_pid != @self do %> @@ -186,10 +186,10 @@ defmodule LivebookWeb.SessionLive do
-
-
-
-

+
+
+