A beautiful, web-based tool for creating, editing, and organizing markdown notes with real-time preview.
- 📝 Browse and edit markdown files in a directory
- ✨ Create new markdown files
- 👁️ Preview markdown rendering in real-time
- 🔍 Search across all your notes
- 🏷️ Tag support for better organization
- 📂 Category support for hierarchical organization
- 🌙 Dark mode support
- ⚡ Keyboard shortcuts for quick actions
- 🔄 Auto-save functionality
- 💾 Simple file management
- 📱 Responsive design for all device sizes
- 🔍 Full-text search capabilities
- 🔗 Easy navigation between linked notes
- 📄 YAML frontmatter support
- 🧩 Customizable configuration
- 📦 Embedded web assets - run from any directory
- Rust and Cargo (1.54.0 or newer)
The simplest way to install mdlib is through cargo:
cargo install mdlibOnce installed, you can run mdlib from any directory to serve that directory's markdown files.
- Clone the repository (or download the source code):
git clone https://github.com/bahdotsh/mdlib.git
cd mdlib- Build the project:
cargo build --releaseThe compiled binary will be located in target/release/mdlib.
To start mdlib, run:
mdlib [DIRECTORY]Where [DIRECTORY] is the path to the directory containing your markdown files. If not specified, the current directory is used.
You can also specify a custom configuration file:
mdlib --config-file /path/to/config.json [DIRECTORY]Once started, open your browser and navigate to http://localhost:3000.
mdlib includes special commands to manage your configuration:
# Show config file location and current settings
mdlib --config
# Create a default config file
mdlib --config create
# List all embedded static files (for debugging)
mdlib --list-embeddedCtrl/Cmd + S: Save current fileCtrl/Cmd + B: Bold selected textCtrl/Cmd + I: Italicize selected textCtrl/Cmd + P: Toggle preview modeCtrl/Cmd + N: Create new note
src/: Source codemain.rs: Entry pointfs.rs: File system operationsserver.rs: Web server and API endpointsconfig.rs: Configuration managementembedded.rs: Embedded static assets handler
static/: Static web files (embedded into the binary at compile time)index.html: Main HTML pagecss/: Stylesheetsjs/: JavaScript files
# Clone the repository
git clone https://github.com/bahdotsh/mdlib.git
cd mdlib
# Build the project
cargo build --release
# Run the application
./target/release/mdlibYou can specify a custom configuration file with the --config-file option:
mdlib --config-file /path/to/config.jsonConfiguration options include:
- Server port
- Bind address
- File watching
- Maximum file size
- Default theme preference
Here's a sample config.json file with default settings:
{
"port": 3000,
"watch_files": true,
"bind_address": "127.0.0.1",
"max_file_size_mb": 10,
"default_dark_mode": false
}These settings can be customized according to your preferences:
port: The HTTP port for the mdlib server (default: 3000)watch_files: Whether to watch for file changes and auto-refresh (default: true)bind_address: The address to bind to (default: "127.0.0.1", use "0.0.0.0" to allow external access)max_file_size_mb: Maximum file size in megabytes (default: 10)default_dark_mode: Start in dark mode by default (default: false)
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
