feat(pastes): use rustler for highlight NIF
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
7 files changed
+604
-5
No files matched your search
@@ -2,5 +2,9 @@ defmodule Ketbin.Utils.Syntax do
|
||||
use Rustler, otp_app: :ketbin, crate: "ketbin_utils_syntax"
|
||||
|
||||
# When your NIF is loaded, it will override this function.
|
||||
def add(_a, _b), do: :erlang.nif_error(:nif_not_loaded)
|
||||
def add(_a, _b), do: error()
|
||||
|
||||
def highlight_text(_text, _lang), do: error()
|
||||
|
||||
defp error(), do: :erlang.nif_error(:nif_not_loaded)
|
||||
end
|
||||
@@ -8,5 +8,5 @@
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<code class="break-word px-6 py-4 h-full w-full nomarkdown overflow-y-auto"><%= @paste.content %></code>
|
||||
<code class="break-word px-6 py-4 h-full w-full nomarkdown overflow-y-auto"><%= raw Ketbin.Utils.Syntax.highlight_text(@paste.content, "rs") %></code>
|
||||
</div>
|
||||
Reference in new issue
Block a user