preview
Path to markdown file, plan directory, or plans collection
- License 许可
- MIT
- 最近更新
- 2026-10-09
- Stars
- ★ 2
- Forks
- 1
01 前言 Front Matter
- name
- preview
- metadata
- { "author": "claudekit", "version": "1.0.0" }
- description
- Path to markdown file, plan directory, or plans collection
03 SKILL.md 正文
Universal viewer using markdown-novel-viewer skill - pass ANY path and see it rendered nicely.
Usage
/preview <file.md>- View markdown file in novel-reader UI/preview <directory/>- Browse directory contents/preview --stop- Stop running server
Examples
/preview plans/my-plan/plan.md # View markdown file
/preview plans/ # Browse plans directory
/preview docs/ # Browse docs directory
/preview any/path/to/file.md # View any markdown file
/preview any/path/ # Browse any directory
Execution
IMPORTANT: Run server as Claude Code background task using run_in_background: true with the Bash tool. This makes the server visible in /tasks and manageable via KillShell.
Check if this script is located in the current workspace or in $HOME/.opencode/skills/markdown-novel-viewer directory:
- If in current workspace:
$SKILL_DIR_PATH=./.opencode/skills/markdown-novel-viewer/ - If in home directory:
$SKILL_DIR_PATH=$HOME/.opencode/skills/markdown-novel-viewer/
Stop Server
If --stop flag is provided:
node $SKILL_DIR_PATH/scripts/server.cjs --stop
Start Server
Otherwise, run the markdown-novel-viewer server as CC background task with --foreground flag (keeps process alive for CC task management):
# Determine if path is file or directory
INPUT_PATH="{{path}}"
if [[ -d "$INPUT_PATH" ]]; then
# Directory mode - browse
node $SKILL_DIR_PATH/scripts/server.cjs \
--dir "$INPUT_PATH" \
--host 127.0.0.1 \
--open \
--foreground
else
# File mode - view markdown
node $SKILL_DIR_PATH/scripts/server.cjs \
--file "$INPUT_PATH" \
--host 127.0.0.1 \
--open \
--foreground
fi
Critical: When calling the Bash tool:
- Set
run_in_background: trueto run as CC background task - Set
timeout: 300000(5 minutes) to prevent premature termination - Parse JSON output and report URL to user
Example Bash tool call:
{
"command": "node .opencode/skills/markdown-novel-viewer/scripts/server.cjs --dir \"path\" --host 127.0.0.1 --open --foreground",
"run_in_background": true,
"timeout": 300000,
"description": "Start preview server in background"
}
After starting, parse the JSON output (e.g., {"success":true,"url":"htt~/.seosona/path/:3456/view?file=...","networkUrl":"htt~/.seosona/path/:3456/view?file=..."}) and report:
- Local URL for browser access
- Network URL only when explicitly authorized for remote device access
- Inform user that server is now running as CC background task (visible in
/tasks)
CRITICAL: MUST display the FULL URL including path and query string (e.g., htt~/.seosona/path/:3456/view?file=/path/to/file.md). NEVER truncate to just host:port (e.g., htt~/.seosona/path/:3456). The full URL is required for direct file access.
04 同仓库更多 Skills
web_crawler_katana
High-speed web crawling using Katana patterns for deep site mapping, URL discovery, and content extraction.
server_log_analyzer
Analyzes Nginx/Apache server logs to identify Googlebot crawl patterns, errors, and performance bottlenecks.
schema_markup_generator
Auto-generates JSON-LD structured data for any page type (Article, Product, FAQ, LocalBusiness, etc.).
internal_linking_optimizer
Analyzes and optimizes the internal link graph of a website for SEO authority distribution.
google_trends_analyzer
Detects trending topics and seasonal patterns using Google Trends data for content planning and keyword strategy.
brand_context_analyzer
Tracks brand mentions, sentiment, and online reputation across web sources.