dashboard / bmp/adding-bookmarks / bump marked #77 rss

open · opened on 2025-08-25T23:01:54Z by bmp
Help
checkout latest patchset:
ssh pr.pico.sh print pr-77 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 77
add review to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add --review 77
accept PR:
ssh pr.pico.sh pr accept 77
close PR:
ssh pr.pico.sh pr close 77

Logs

bmp created pr with ps-149 on 2025-08-25T23:01:54Z
bmp reviewed pr with ps-150 on 2025-08-25T23:06:33Z

Patchsets

ps-149 by bmp on 2025-08-25T23:01:54Z
Range Diff ↕ rd-150
1: cc87831 = 1: cc87831 bump marked
2: b72fc67 = 2: b72fc67 add bookmarks
-: ------- > 3: 02e54a0 review
ps-150 by bmp on 2025-08-25T23:06:33Z

Patchset ps-150

bump marked

Benjamin Pollack
2025-08-24T17:28:53Z
deno.jsonc
+1 -1
deno.lock
+4 -4

add bookmarks

Benjamin Pollack
2025-08-24T17:32:57Z
commands.ts
+2 -0
deno.jsonc
+4 -1
deno.lock
+38 -3

REVIEW review

Benjamin Pollack
2025-08-25T23:04:42Z
Back to top

bump marked

deno.jsonc link
+1 -1
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
diff --git a/deno.jsonc b/deno.jsonc
index cfe9944..a950734 100644
--- a/deno.jsonc
+++ b/deno.jsonc
@@ -14,7 +14,7 @@
     "@std/path": "jsr:@std/path@^1.1.2",
     "@std/text": "jsr:@std/text@^1.0.16",
     "@std/ulid": "jsr:@std/ulid@^1.0.0",
-    "marked": "npm:marked@^16.1.2"
+    "marked": "npm:marked@^16.2.0"
   },
   "tasks": {
     "install": "deno install -g -f -n hsh -c deno.jsonc -A main.ts"
deno.lock link
+4 -4
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff --git a/deno.lock b/deno.lock
index 8d525a2..5d315e4 100644
--- a/deno.lock
+++ b/deno.lock
@@ -36,7 +36,7 @@
     "jsr:@std/toml@^1.0.3": "1.0.9",
     "jsr:@std/ulid@1": "1.0.0",
     "jsr:@std/yaml@^1.0.5": "1.0.9",
-    "npm:marked@^16.1.2": "16.1.2"
+    "npm:marked@^16.2.0": "16.2.0"
   },
   "jsr": {
     "@cliffy/ansi@1.0.0-rc.8": {
@@ -185,8 +185,8 @@
     }
   },
   "npm": {
-    "marked@16.1.2": {
-      "integrity": "sha512-rNQt5EvRinalby7zJZu/mB+BvaAY2oz3wCuCjt1RDrWNpS1Pdf9xqMOeC9Hm5adBdcV/3XZPJpG58eT+WBc0XQ==",
+    "marked@16.2.0": {
+      "integrity": "sha512-LbbTuye+0dWRz2TS9KJ7wsnD4KAtpj0MVkWc90XvBa6AslXsT0hTBVH5k32pcSyHH1fst9XEFJunXHktVy0zlg==",
       "bin": true
     }
   },
@@ -206,7 +206,7 @@
       "jsr:@std/path@^1.1.2",
       "jsr:@std/text@^1.0.16",
       "jsr:@std/ulid@1",
-      "npm:marked@^16.1.2"
+      "npm:marked@^16.2.0"
     ]
   }
 }

add bookmarks

commands.ts link
+2 -0
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
diff --git a/commands.ts b/commands.ts
index 9b6d8f8..b849140 100644
--- a/commands.ts
+++ b/commands.ts
@@ -1,5 +1,6 @@
 import { Command } from "@cliffy/command";
 
+import bookmarkPlugin from "./plugins/bookmarks.ts";
 import corePlugin from "./plugins/core.ts";
 import folderPlugin from "./plugins/folder.ts";
 import gitPlugin from "./plugins/git.ts";
@@ -9,6 +10,7 @@ import searchPlugin from "./plugins/search.ts";
 import todoPlugin from "./plugins/todo.ts";
 
 const plugins = [
+  bookmarkPlugin,
   corePlugin,
   folderPlugin,
   gitPlugin,
deno.jsonc link
+4 -1
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff --git a/deno.jsonc b/deno.jsonc
index a950734..fce514c 100644
--- a/deno.jsonc
+++ b/deno.jsonc
@@ -1,9 +1,11 @@
 {
   "imports": {
+    "@b-fuze/deno-dom": "jsr:@b-fuze/deno-dom@^0.1.56",
     "@cliffy/ansi": "jsr:@cliffy/ansi@^1.0.0-rc.8",
     "@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.8",
     "@david/dax": "jsr:@david/dax@^0.43.2",
     "@littletof/charmd": "jsr:@littletof/charmd@^0.1.2",
+    "@mozilla/readability": "npm:@mozilla/readability@^0.6.0",
     "@std/assert": "jsr:@std/assert@^1.0.14",
     "@std/collections": "jsr:@std/collections@^1.1.3",
     "@std/datetime": "jsr:@std/datetime@^0.225.5",
@@ -14,7 +16,8 @@
     "@std/path": "jsr:@std/path@^1.1.2",
     "@std/text": "jsr:@std/text@^1.0.16",
     "@std/ulid": "jsr:@std/ulid@^1.0.0",
-    "marked": "npm:marked@^16.2.0"
+    "marked": "npm:marked@^16.2.0",
+    "turndown": "npm:turndown@^7.2.1"
   },
   "tasks": {
     "install": "deno install -g -f -n hsh -c deno.jsonc -A main.ts"
deno.lock link
+38 -3
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
diff --git a/deno.lock b/deno.lock
index 5d315e4..4532fa7 100644
--- a/deno.lock
+++ b/deno.lock
@@ -1,6 +1,7 @@
 {
   "version": "5",
   "specifiers": {
+    "jsr:@b-fuze/deno-dom@~0.1.56": "0.1.56",
     "jsr:@cliffy/ansi@^1.0.0-rc.8": "1.0.0-rc.8",
     "jsr:@cliffy/command@^1.0.0-rc.8": "1.0.0-rc.8",
     "jsr:@cliffy/flags@1.0.0-rc.8": "1.0.0-rc.8",
@@ -10,11 +11,13 @@
     "jsr:@david/dax@~0.43.2": "0.43.2",
     "jsr:@david/path@0.2": "0.2.0",
     "jsr:@david/which@~0.4.1": "0.4.1",
+    "jsr:@denosaurs/plug@1.1.0": "1.1.0",
     "jsr:@littletof/charmd@~0.1.2": "0.1.2",
     "jsr:@std/assert@^1.0.14": "1.0.14",
     "jsr:@std/bytes@^1.0.5": "1.0.6",
     "jsr:@std/collections@^1.1.3": "1.1.3",
     "jsr:@std/datetime@~0.225.5": "0.225.5",
+    "jsr:@std/encoding@1": "1.0.10",
     "jsr:@std/encoding@~1.0.5": "1.0.10",
     "jsr:@std/fmt@0.223.0": "0.223.0",
     "jsr:@std/fmt@1": "1.0.8",
@@ -36,14 +39,22 @@
     "jsr:@std/toml@^1.0.3": "1.0.9",
     "jsr:@std/ulid@1": "1.0.0",
     "jsr:@std/yaml@^1.0.5": "1.0.9",
-    "npm:marked@^16.2.0": "16.2.0"
+    "npm:@mozilla/readability@0.6": "0.6.0",
+    "npm:marked@^16.2.0": "16.2.0",
+    "npm:turndown@^7.2.1": "7.2.1"
   },
   "jsr": {
+    "@b-fuze/deno-dom@0.1.56": {
+      "integrity": "8030e2dc1d8750f1682b53462ab893d9c3470f2287feecbe22f44a88c54ab148",
+      "dependencies": [
+        "jsr:@denosaurs/plug"
+      ]
+    },
     "@cliffy/ansi@1.0.0-rc.8": {
       "integrity": "ba37f10ce55bbfbdd8ddd987f91f029b17bce88385b98ba3058870f3b007b80c",
       "dependencies": [
         "jsr:@cliffy/internal",
-        "jsr:@std/encoding",
+        "jsr:@std/encoding@~1.0.5",
         "jsr:@std/fmt@~1.0.2"
       ]
     },
@@ -97,6 +108,15 @@
     "@david/which@0.4.1": {
       "integrity": "896a682b111f92ab866cc70c5b4afab2f5899d2f9bde31ed00203b9c250f225e"
     },
+    "@denosaurs/plug@1.1.0": {
+      "integrity": "eb2f0b7546c7bca2000d8b0282c54d50d91cf6d75cb26a80df25a6de8c4bc044",
+      "dependencies": [
+        "jsr:@std/encoding@1",
+        "jsr:@std/fmt@1",
+        "jsr:@std/fs@1",
+        "jsr:@std/path@1"
+      ]
+    },
     "@littletof/charmd@0.1.2": {
       "integrity": "1d349b5a4acb3d9fe054e5c856ee8a5c0f18bbdccf1f0d733b6e73d518514928",
       "dependencies": [
@@ -185,13 +205,26 @@
     }
   },
   "npm": {
+    "@mixmark-io/domino@2.2.0": {
+      "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw=="
+    },
+    "@mozilla/readability@0.6.0": {
+      "integrity": "sha512-juG5VWh4qAivzTAeMzvY9xs9HY5rAcr2E4I7tiSSCokRFi7XIZCAu92ZkSTsIj1OPceCifL3cpfteP3pDT9/QQ=="
+    },
     "marked@16.2.0": {
       "integrity": "sha512-LbbTuye+0dWRz2TS9KJ7wsnD4KAtpj0MVkWc90XvBa6AslXsT0hTBVH5k32pcSyHH1fst9XEFJunXHktVy0zlg==",
       "bin": true
+    },
+    "turndown@7.2.1": {
+      "integrity": "sha512-7YiPJw6rLClQL3oUKN3KgMaXeJJ2lAyZItclgKDurqnH61so4k4IH/qwmMva0zpuJc/FhRExBBnk7EbeFANlgQ==",
+      "dependencies": [
+        "@mixmark-io/domino"
+      ]
     }
   },
   "workspace": {
     "dependencies": [
+      "jsr:@b-fuze/deno-dom@~0.1.56",
       "jsr:@cliffy/ansi@^1.0.0-rc.8",
       "jsr:@cliffy/command@^1.0.0-rc.8",
       "jsr:@david/dax@~0.43.2",
@@ -206,7 +239,9 @@
       "jsr:@std/path@^1.1.2",
       "jsr:@std/text@^1.0.16",
       "jsr:@std/ulid@1",
-      "npm:marked@^16.2.0"
+      "npm:@mozilla/readability@0.6",
+      "npm:marked@^16.2.0",
+      "npm:turndown@^7.2.1"
     ]
   }
 }
plugins/bookmarks.ts link
+29 -0
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/plugins/bookmarks.ts b/plugins/bookmarks.ts
new file mode 100644
index 0000000..caf8203
--- /dev/null
+++ b/plugins/bookmarks.ts
@@ -0,0 +1,29 @@
+import { Command } from "@cliffy/command";
+import { Readability } from "@mozilla/readability";
+import { DOMParser } from "@b-fuze/deno-dom";
+import TurndownService from "turndown";
+
+import { currentNotebook, getNotebooks, iconForEntry } from "../notebooks.ts";
+import { print } from "../utils.ts";
+
+function addCommands(cmd: Command) {
+  cmd
+    .command("bookmark", getBookmarkCommands().alias("bm"));
+}
+
+function getBookmarkCommands() {
+  return new Command()
+    .command("add", "add a bookmark")
+    .description("manage bookmarks")
+    .arguments("<url:string>")
+    .action(async (_opts, url) => {
+      const content = await (await fetch(url)).text();
+      const dom = new DOMParser().parseFromString(content, "text/html");
+      const readable = new Readability(dom);
+      const parsed = readable.parse();
+      if (parsed == null) throw new Error("nope");
+      const md = new TurndownService().turndown(parsed.content);
+    });
+}
+
+export default { addCommands };

review

plugins/bookmarks.ts link
+2 -0
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
diff --git a/plugins/bookmarks.ts b/plugins/bookmarks.ts
index caf8203..e13bd78 100644
--- a/plugins/bookmarks.ts
+++ b/plugins/bookmarks.ts
@@ -7,10 +7,12 @@ import { currentNotebook, getNotebooks, iconForEntry } from "../notebooks.ts";
 import { print } from "../utils.ts";
 
 function addCommands(cmd: Command) {
+  // What's with the potty humor?
   cmd
     .command("bookmark", getBookmarkCommands().alias("bm"));
 }
 
+// This function makes me depressed
 function getBookmarkCommands() {
   return new Command()
     .command("add", "add a bookmark")