Add highlights

This commit is contained in:
2024-04-05 21:35:39 +11:00
parent d02b74621a
commit 38d5108979
22 changed files with 188 additions and 25 deletions

View File

@@ -184,7 +184,7 @@ module Main
def fetch!(slug)
posts
.published
.combine(:tags, :trips, :webmentions, :reactions)
.combine(:tags, :trips, :webmentions, :reactions, :highlights)
.node(:webmentions) { |webmention|
webmention.published.where(type: "reply")
}

View File

@@ -13,6 +13,13 @@ div class="mb-12 prose dark:prose-invert max-w-prose mx-auto text-gray-800 dark:
== bookmark.content
- if bookmark.highlights.count > 0
h2 Highlights
- bookmark.highlights.each do |highlight|
div class="rounded p-2 bg-amber-100 dark:bg-amber-800 mb-4"
= render "shared/quote", color: "fill-amber-200 dark:fill-amber-700"
= highlight.text
- unless bookmark.cached_content.nil?
button class="hover:text-gray-400" @click="open = ! open" Toggle cached version

View File

@@ -31,9 +31,9 @@ html x-data="{darkMode: $persist(false)}" :class="{'dark' : darkMode === true}"
script data-goatcounter="https://stats.dnitza.com/count" async="" src="//stats.dnitza.com/count.js"
script src="https://unpkg.com/htmx.org@1.9.2/dist/htmx.min.js" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"
script src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.13.3/dist/cdn.min.js"
script src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.13.8/dist/cdn.min.js"
= javascript_tag "app"
script src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.3/dist/cdn.min.js" defer=""
script src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.8/dist/cdn.min.js" defer=""
link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.8.0/styles/github-dark.min.css"
script src="https://unpkg.com/@highlightjs/cdn-assets@11.8.0/highlight.min.js" defer=""

View File

@@ -0,0 +1,12 @@
- color_class = defined?(color) ? color : "fill-gray-900"
xml version="1.0" encoding="iso-8859-1"
svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 57 57" xml:space="preserve" class="w-8"
g
circle class="#{color_class}" cx="18.5" cy="31.5" r="5.5"
path class="#{color_class}" d="M18.5,38c-3.584,0-6.5-2.916-6.5-6.5s2.916-6.5,6.5-6.5s6.5,2.916,6.5,6.5S22.084,38,18.5,38z M18.5,27c-2.481,0-4.5,2.019-4.5,4.5s2.019,4.5,4.5,4.5s4.5-2.019,4.5-4.5S20.981,27,18.5,27z"
g
circle class="#{color_class}" cx="35.5" cy="31.5" r="5.5"
path class="#{color_class}" d="M35.5,38c-3.584,0-6.5-2.916-6.5-6.5s2.916-6.5,6.5-6.5s6.5,2.916,6.5,6.5S39.084,38,35.5,38z M35.5,27c-2.481,0-4.5,2.019-4.5,4.5s2.019,4.5,4.5,4.5s4.5-2.019,4.5-4.5S37.981,27,35.5,27z"
path class="#{color_class}" d="M13,32c-0.553,0-1-0.447-1-1c0-7.72,6.28-14,14-14c0.553,0,1,0.447,1,1s-0.447,1-1,1 c-6.617,0-12,5.383-12,12C14,31.553,13.553,32,13,32z"
path class="#{color_class}" d="M30,32c-0.553,0-1-0.447-1-1c0-7.72,6.28-14,14-14c0.553,0,1,0.447,1,1s-0.447,1-1,1 c-6.617,0-12,5.383-12,12C31,31.553,30.553,32,30,32z"