Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-server-markdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
http-server-markdown
A CLI tool to serve and preview markdown files with directory navigation, code highlighting, and mermaid diagram support.
Features
- 📁 Directory tree navigation
- 📝 Markdown preview with syntax highlighting
- 📊 Mermaid diagram rendering
- 🔄 Toggle between rendered preview and source view
- 🚀 Easy to use CLI interface
Installation
You can use http-server-markdown
without installing it by using npx
:
npx http-server-markdown
Or you can install it globally:
npm install -g http-server-markdown
Usage
Basic Usage
Navigate to any directory containing markdown files and run:
npx http-server-markdown
This will start a server on port 3000 and open your browser automatically.
Command Line Options
Usage: http-server-markdown [options]
A CLI tool to serve and preview markdown files with directory navigation
Options:
-V, --version output the version number
-p, --port <port> Port to use (default: "3000")
-o, --open Open browser automatically (default: true)
-d, --directory <directory> Directory to serve (default: current directory)
-h, --help display help for command
Examples
Serve files from a specific directory:
npx http-server-markdown --directory ./docs
Use a different port:
npx http-server-markdown --port 8080
Start server without opening browser:
npx http-server-markdown --no-open
Features in Detail
Directory Navigation
The left sidebar displays a tree view of all directories and markdown files. Click on folders to expand/collapse them and click on files to preview them.
Markdown Preview
When you select a markdown file, it will be rendered in the preview pane with:
- Syntax highlighting for code blocks
- Mermaid diagram rendering
- GitHub-style markdown formatting
Source View
You can toggle between the rendered preview and the source markdown by clicking the "Toggle View" button.
Mermaid Diagram Support
To include a mermaid diagram in your markdown, use the following syntax:
```mermaid
graph TD
A[Start] --> B{Is it?}
B -->|Yes| C[OK]
B -->|No| D[End]
```
Development and Contributing
Setting up for Development
Clone the repository
git clone https://github.com/ashokkasti/http-server-markdown.git cd http-server-markdown
Install dependencies
npm install
Run locally
npm start
Automated Publishing
This package uses GitHub Actions to automatically publish to npm when a new release is created.
- When you're ready to release a new version, create a new release in GitHub
- Tag the release with a semantic version (e.g.,
v1.0.1
) - The GitHub Actions workflow will automatically publish the package to npm
Note: The repository owner needs to add an NPM_TOKEN secret to the GitHub repository settings. This token should have publish permissions for the npm package.
License
MIT