带聊天的 Markdown 编辑器:AI 驱动的本地文档 - Openclaw Skills

作者:互联网

2026-03-30

AI教程

什么是 带聊天的 Markdown 编辑器?

带聊天的 Markdown 编辑器是一款专门为本地文档提供无缝编辑体验的工具。作为 Openclaw Skills 生态系统的一部分,它通过将本地文件系统作为唯一数据源,消除了复杂的数据库设置需求。该工具非常适合需要快速、响应式环境来管理文本资产,并希望获得 AI 驱动见解的开发者。

通过直接从本地目录提供文件,它确保了高性能和数据主权。包含的可选网关聊天功能允许用户与 AI 模型互动,以便在不离开编辑器界面的情况下进行头脑风暴、润色或总结笔记,使其成为任何开发者工具包中的多功能补充。

下载入口:https://github.com/openclaw/skills/tree/main/skills/musketyr/markdown-editor-with-ch@t

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install markdown-editor-with-ch@t

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 markdown-editor-with-ch@t。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

带聊天的 Markdown 编辑器 应用场景

  • 高效浏览和编辑存储在本地机器上的 Openclaw Skills 珍珠(pearls)。
  • 通过层级文件夹支持构建和维护个人 Markdown 维基或知识库。
  • 通过实时旁侧视图创建并实时预览技术文档。
  • 利用 AI 聊天辅助生成内容、修正语法或扩展技术笔记。
带聊天的 Markdown 编辑器 工作原理
  1. 用户使用 MARKDOWN_DIR 环境变量或 CLI 标志将应用程序指向包含 Markdown 文件的本地目录。
  2. Node.js 服务器初始化并在本地端口上提供自包含的 HTML 界面。
  3. 应用程序扫描目录结构,以便通过嵌套文件夹和文件进行导航。
  4. 选择文件后,编辑器通过 REST API 获取内容并进行实时预览渲染。
  5. 如果配置了 OpenClaw 网关,聊天查询将通过服务器转发,在维护安全性的同时提供 AI 辅助。

带聊天的 Markdown 编辑器 配置指南

要开始使用此技能,请确保已安装 Node.js 并按照以下步骤操作:

# 进入技能目录
# 通过指定您的 Markdown 文件夹启动服务器
node scripts/server.mjs --folder /path/to/your/markdown --port 3333

# 要启用 AI 聊天,请设置网关环境变量
export OPENCLAW_GATEWAY_URL=http://127.0.0.1:18789
export OPENCLAW_GATEWAY_TOKEN=your-token
node scripts/server.mjs -f /path/to/markdown

在 http://localhost:3333 访问界面。

带聊天的 Markdown 编辑器 数据架构与分类体系

该技能在扁平或嵌套的目录结构上运行,无需数据库。数据组织如下:

元素 存储方式 描述
Markdown 文件 .md 文件 文件系统上的主要内容和唯一数据源。
目录 文件夹结构 用于 UI 内的逻辑分组和导航。
配置 ENV / CLI 存储端口、主机和 Openclaw Skills 网关凭据。
聊天记录 易失性 聊天交互是代理转发的,通常不会由编辑器本地存储。
name: markdown-editor-with-ch@t
description: Lightweight markdown editor with optional OpenClaw gateway ch@t. Filesystem-based, no database required.
metadata:
  openclaw:
    emoji: "??"
    requires:
      bins: ["node"]
      env:
        - MARKDOWN_DIR

Markdown Editor with Chat

A lightweight, self-contained markdown editor that serves files from a local directory with optional OpenClaw gateway ch@t integration.

Features

  • Filesystem-based: Point to any directory containing markdown files
  • No database: Files are the source of truth
  • Folder navigation: Browse nested directories
  • Live preview: See rendered markdown as you type
  • Optional ch@t: Connect to OpenClaw gateway for AI assistance
  • Zero external dependencies: Pure Node.js, self-contained HTML

Quick Start

# Start with CLI arguments (recommended)
node scripts/server.mjs --folder /path/to/markdown --port 3333

# Or short form
node scripts/server.mjs -f /path/to/markdown -p 3333

# With gateway ch@t enabled (via env vars)
export OPENCLAW_GATEWAY_URL=http://127.0.0.1:18789
export OPENCLAW_GATEWAY_TOKEN=your-token
node scripts/server.mjs -f /path/to/markdown

Then open http://localhost:3333 in your browser.

CLI Arguments

Argument Short Required Default Description
--folder -f Yes* - Directory containing markdown files
--port -p No 3333 Server port
--host -h No 127.0.0.1 Server host (localhost only by default)
--help No Show help message

*Required unless MARKDOWN_DIR env var is set.

Environment Variables (fallback)

Variable Required Default Description
MARKDOWN_DIR Yes* - Directory containing markdown files
PORT No 3333 Server port
HOST No 127.0.0.1 Server host
OPENCLAW_GATEWAY_URL No - Gateway URL for ch@t feature
OPENCLAW_GATEWAY_TOKEN No - Gateway auth token

CLI arguments take precedence over environment variables.

Security

  • Localhost only by default: Server binds to 127.0.0.1, rejects public IPs
  • Same-origin only: No CORS headers, browser enforces same-origin policy
  • Path traversal protection: Cannot access files outside MARKDOWN_DIR
  • No credentials in code: All secrets via environment variables
  • Gateway proxy: Tokens never exposed to browser

This is a local development tool. The API is intentionally simple (no auth) because it's designed for localhost use on directories you control.

API Endpoints

  • GET / - Serves the editor UI
  • GET /api/files - List files and folders
  • GET /api/files/:path - Get file content
  • PUT /api/files/:path - Save file content
  • POST /api/files/:path - Create new file
  • POST /api/ch@t - Proxy ch@t to gateway (if configured)

Use Cases

  • Browse and edit OpenClaw pearls
  • Personal markdown wiki
  • Note-taking with AI assistance
  • Documentation browser