@thedreamlabuk/logseq-publisher
v0.0.4
Published
Fast Logseq graph parser and publisher powered by Rust and WASM - based on logseq/publish-spa (experimental alpha)
Maintainers
Readme
Logseq Publisher
⚠️ Version 0.0.1 - Untested Alpha Release This is an experimental Rust/WASM port based on logseq/publish-spa. Use at your own risk. Not yet ready for production use.
Fast Logseq graph parser and static site generator powered by Rust and WebAssembly.
Features
- ⚡ Blazingly Fast: Rust + WASM for optimal performance
- 📊 Graph Analysis: Full graph traversal and backlink detection
- 🎨 Beautiful Output: Clean, responsive HTML with customizable themes
- 🔍 Smart Parsing: Handles Logseq markdown, EDN properties, and wiki-links
- 📦 Zero Config: Works out of the box with sensible defaults
- 🚀 Production Ready: Optimized assets and minimal bundle size
Installation
npm install -g @thedreamlabuk/logseq-publisherUsage
CLI
# Build your graph
logseq-publish build -i ./my-graph -o ./public
# Show statistics
logseq-publish stats -i ./my-graph
# Find backlinks
logseq-publish backlinks "my-page.md" -i ./my-graphProgrammatic API
import { publish, parseGraph, getBacklinks } from '@thedreamlabuk/logseq-publisher';
// Publish graph
const stats = await publish({
inputDir: './graph',
outputDir: './public',
theme: 'default',
includeBacklinks: true,
includeGraphView: false,
});
console.log(`Published ${stats.page_count} pages`);
// Analyze graph
const graphStats = await parseGraph('./graph');
// Get backlinks
const backlinks = await getBacklinks('./graph', 'my-page.md');Building from Source
Prerequisites
- Rust 1.70+
- Node.js 18+
- wasm-pack
Build Steps
# Clone repository
git clone <repo-url>
cd logseq-publisher-npm
# Build WASM module
npm run build:wasm
# Build npm package
npm run build
# Test
npm testArchitecture
┌─────────────────────────────────────┐
│ CLI / JavaScript API │
├─────────────────────────────────────┤
│ WASM Bindings (wasm-bindgen) │
├─────────────────────────────────────┤
│ Rust Core │
│ ├── Parser (markdown + EDN) │
│ ├── Graph (traversal + backlinks) │
│ ├── Optimizer (assets) │
│ └── Exporter (HTML generation) │
└─────────────────────────────────────┘Performance
- Parser: ~10,000 pages/second
- WASM Size: ~150KB gzipped
- Memory: O(n) where n = total blocks
Attribution
This project is a Rust/WASM reimplementation based on the original Logseq publish-spa by the Logseq team. The original is written in Clojure/Babashka. This port aims to provide the same functionality with improved performance through Rust and WebAssembly.
License
MIT
Acknowledgments
- Original publish-spa by the Logseq team
- Logseq - A privacy-first, open-source knowledge base
