llmd 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -19
- package/dist/client.js +1 -1
- package/dist/llmd +93 -69
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
# llmd
|
|
2
2
|
|
|
3
|
-
**Serve Markdown as
|
|
3
|
+
**Serve Markdown as HTML, instantly.**
|
|
4
4
|
|
|
5
|
-
A minimal CLI tool for viewing Markdown files in your browser with syntax highlighting, live reload, and
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install -g llmd
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or run directly without installing:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx llmd
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Requires Node.js 22 or later.
|
|
5
|
+
A minimal CLI tool for viewing Markdown files in your browser with syntax highlighting, live reload, and optional event analytics. Built for developers reviewing LLM-generated documentation.
|
|
20
6
|
|
|
21
7
|
## Quick Start
|
|
22
8
|
|
|
@@ -38,9 +24,6 @@ That's it! The docs will open in your browser. Click through the sidebar to expl
|
|
|
38
24
|
- **Syntax highlighting** - Powered by Shiki
|
|
39
25
|
- **Live reload** - Watch mode reloads on file changes
|
|
40
26
|
- **Copy buttons** - One-click code copying
|
|
41
|
-
- **Dark/light themes** - With 9 font combinations
|
|
42
|
-
- **Fast** - Built with Bun, instant startup
|
|
43
|
-
- **Sidebar navigation** - Browse files with directory structure
|
|
44
27
|
- **Table of contents** - Auto-generated from headings
|
|
45
28
|
- **Usage Analytics** - Track which docs you view most (local-only, opt-in)
|
|
46
29
|
|
|
@@ -69,6 +52,11 @@ llmd ./docs --theme dark --watch
|
|
|
69
52
|
|
|
70
53
|
# Open directly to analytics
|
|
71
54
|
llmd analytics
|
|
55
|
+
|
|
56
|
+
# Manage analytics database
|
|
57
|
+
llmd db check # View database stats
|
|
58
|
+
llmd db cleanup --days 30 # Delete old events
|
|
59
|
+
llmd db clear # Clear all analytics data
|
|
72
60
|
```
|
|
73
61
|
|
|
74
62
|
See [Usage](./docs/usage.md) for all options.
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var G=/\/$/,U=(y)=>{let q=y.querySelector(":scope > .dir-label");if(!q)return null;let C=Array.from(q.querySelectorAll("span"));if(C.length===0)return null;let B=C[C.length-1];if(!B.textContent)return null;return B.textContent.replace(G,"")},O=(y)=>{let q=[],C=y;while(C){let B=U(C);if(B)q.unshift(B);let M=C.parentElement;C=M?M.closest(".dir-item"):null}return q.length>0?q.join("/"):null},V=()=>{let y=[],q=document.querySelectorAll(".dir-item.collapsed");for(let C of Array.from(q)){let B=O(C);if(B)y.push(B)}localStorage.setItem("llmd-nav-collapsed",JSON.stringify(y))},_=()=>{try{let y=localStorage.getItem("llmd-nav-collapsed");if(!y)return;let q=JSON.parse(y),C=document.querySelectorAll(".dir-item");for(let B of Array.from(C)){let M=O(B);if(M&&q.includes(M))B.classList.add("collapsed")}}catch(y){console.error("[collapsible] Failed to restore state:",y)}},E=()=>{let y=document.querySelectorAll(".dir-label");for(let q of Array.from(y)){let C=q,B=document.createElement("span");B.className="dir-chevron",B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>',C.insertBefore(B,C.firstChild),C.style.cursor="pointer",C.addEventListener("click",(M)=>{M.preventDefault();let k=C.closest(".dir-item");if(k)k.classList.toggle("collapsed"),V()})}_()},X=()=>{let y=document.querySelector(".toc");if(!y)return;let q=y.querySelector("h3");if(!q)return;let C=document.createElement("span");C.className="toc-chevron",C.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>',q.style.cursor="pointer",q.insertBefore(C,q.firstChild),y.classList.add("collapsed"),q.addEventListener("click",()=>{y.classList.toggle("collapsed")})};if(typeof window<"u")window.addEventListener("DOMContentLoaded",()=>{E(),X()});var Q=()=>{for(let y of Array.from(document.querySelectorAll("pre code"))){let q=y.parentElement;if(!q)continue;if(q.querySelector(".copy-button"))continue;let C=document.createElement("button");C.className="copy-button",C.textContent="Copy",C.setAttribute("aria-label","Copy code to clipboard"),C.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(y.textContent||""),C.textContent="Copied!",C.classList.add("copied"),setTimeout(()=>{C.textContent="Copy",C.classList.remove("copied")},2000)}catch(B){console.error("Failed to copy:",B),C.textContent="Failed",setTimeout(()=>{C.textContent="Copy"},2000)}}),q.appendChild(C)}};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",Q);else Q();var u=(y)=>{let C=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`,B=null,M=null,k=()=>{B=new WebSocket(C),B.addEventListener("open",()=>{console.log("[llmd] Connected to file watcher"),B?.send(JSON.stringify({type:"watch",file:y}))}),B.addEventListener("message",(J)=>{try{let A=JSON.parse(J.data);if(A.type==="reload"&&A.file===y)console.log(`[llmd] File changed: ${y}, reloading...`),window.location.reload()}catch(A){console.error("[llmd] Failed to parse message:",A)}}),B.addEventListener("close",()=>{console.log("[llmd] Disconnected from file watcher"),M=window.setTimeout(()=>{console.log("[llmd] Reconnecting..."),k()},2000)}),B.addEventListener("error",(J)=>{console.error("[llmd] WebSocket error:",J),B?.close()})};k(),window.addEventListener("beforeunload",()=>{if(M)clearTimeout(M);B?.close()})};window.connectFileWatcher=u;var P=()=>{let y=document.querySelector(".sidebar");if(!y)return;let q=document.createElement("div");q.className="sidebar-resize-handle",y.appendChild(q);let C=!1,B=0,M=0,k=(j)=>{C=!0,B=j.clientX,M=y.offsetWidth,document.body.style.cursor="ew-resize",document.body.style.userSelect="none",j.preventDefault()},J=(j)=>{if(!C)return;let f=j.clientX-B,x=M+f,L=Math.max(200,Math.min(600,x));y.style.width=`${L}px`,localStorage.setItem("llmd-sidebar-width",L.toString())},A=()=>{if(!C)return;C=!1,document.body.style.cursor="",document.body.style.userSelect=""};q.addEventListener("mousedown",k),document.addEventListener("mousemove",J),document.addEventListener("mouseup",A);let K=localStorage.getItem("llmd-sidebar-width");if(K){let j=Number.parseInt(K,10);if(j>=200&&j<=600)y.style.width=`${j}px`}};if(typeof window<"u")window.addEventListener("DOMContentLoaded",()=>{P()});var Y=(y,q,C)=>{fetch("/api/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:y,path:q,resourceType:C})}).catch(()=>{})},Z=(y)=>{Y("open",y,"dir")},$=(y)=>{Y("view",y,"file")};window.trackDirectoryOpen=Z;window.trackFileView=$;console.log("[llmd] Client initialized");
|