Browse Source

fix: no syntax highlight in note show

main
Inhji Y. 8 months ago
parent
commit
05773f7b5b
  1. 2
      assets/.babelrc
  2. 1
      assets/js/app.js
  3. 2
      lib/mirage_web/live/show_note_live.html.leex
  4. 35
      lib/mirage_web/templates/note/show.html.eex

2
assets/.babelrc

@ -4,7 +4,7 @@
],
"plugins": [
["prismjs", {
"languages": ["javascript", "css", "markup", "markdown", "elixir", "bash", "sql", "visual-basic"],
"languages": ["javascript", "css", "markup", "markdown", "elixir", "bash", "sql", "vbnet"],
"plugins": [],
"theme": "tomorrow",
"css": true

1
assets/js/app.js

@ -41,3 +41,4 @@ if (document.querySelector(element)) {
}
Prism.highlightAll();

2
lib/mirage_web/live/show_note_live.html.leex

@ -9,7 +9,7 @@
</div>
<div class="width-full bg-content">
<article>
<article phx-update="ignore" id="note-<%= @note.id %>">
<div class="content html">
<%= raw @note.content_html %>
</div>

35
lib/mirage_web/templates/note/show.html.eex

@ -1,35 +0,0 @@
<div class="hero">
<h1><span class="id"><%= "##{@note.id}" %></span> <%= @note.title %></h1>
<p><time datetime="<%= @note.inserted_at %>"><%= Timex.from_now(@note.inserted_at) %></time> / <time datetime="<%= @note.updated_at %>"><%= Timex.from_now(@note.updated_at) %></time></p>
<p class="tags">
<%= for topic <- @note.topics do %>
<span class="tag"><%= topic.text %></span>
<% end %>
</p>
</div>
<div class="width-full bg-content">
<article>
<div class="content html">
<%= raw @note.content_html %>
</div>
</article>
</div>
<%= if not Enum.empty?(@note.backlinks) do %>
<section class="backlinks">
<h4>Backlinks</h4>
<%= for backlink <- @note.backlinks do %>
<%= link backlink.title, to: Routes.live_path(@conn, MirageWeb.ShowNoteLive, backlink), class: "backlink bg-content" %>
<% end %>
</section>
<% end %>
<%= if @current_user do %>
<div class="buttons">
<span><%= link "Edit", to: Routes.note_path(@conn, :edit, @note), class: "button" %></span>
<span><%= link "Back", to: Routes.note_path(@conn, :index), class: "button" %></span>
<span><%= link "Delete", to: Routes.note_path(@conn, :delete, @note), method: :delete, data: [confirm: "Are you sure?"], class: "button" %></span>
</div>
<% end %>
Loading…
Cancel
Save