Files
gobsidian/README.md
2025-08-28 08:07:30 +01:00

165 lines
5.3 KiB
Markdown

# Gobsidian
A modern, responsive web interface for viewing and editing Obsidian markdown notes, built with Go and TailwindCSS.
## Features
- **Responsive Design**: Works seamlessly on desktop and mobile devices
- **Dark Theme**: Beautiful dark interface optimized for extended use
- **Multiple Image Storage Modes**: Flexible image storage options to match Obsidian's behavior
- **File Management**: Upload, download, edit, and delete files and notes
- **Syntax Highlighting**: Code blocks with syntax highlighting for multiple languages
- **Search Functionality**: Quick search through your notes
- **Settings Management**: Web-based configuration interface
- **Markdown Rendering**: Full markdown support with Obsidian-style features
## Image Storage Modes
1. **Root Directory**: Store images directly in the notes root directory
2. **Specific Folder**: Store all images in a designated folder
3. **Same as Note**: Store images in the same directory as the note
4. **Subfolder of Note**: Store images in a subfolder within the note's directory
## Installation
1. Clone the repository:
```bash
git clone https://github.com/yourusername/gobsidian.git
cd gobsidian
```
2. Install dependencies:
```bash
go mod download
```
3. Run the application:
```bash
go run cmd/main.go
```
4. Open your browser and navigate to `http://localhost:8080`
## Configuration
On first run, Gobsidian will create a `settings.ini` file with default configurations. You can modify these settings through the web interface at `/settings` or by editing the file directly.
### Default Configuration
```ini
[SERVER]
HOST = 0.0.0.0
PORT = 8080
SECRET_KEY = change-this-secret-key
DEBUG = false
MAX_CONTENT_LENGTH = 16
[MD_NOTES_APP]
APP_NAME = Gobsidian
NOTES_DIR = notes
NOTES_DIR_HIDE_SIDEPANE = attached, images
NOTES_DIR_SKIP = secret, private
IMAGES_HIDE = false
IMAGE_STORAGE_MODE = 1
IMAGE_STORAGE_PATH = images
IMAGE_SUBFOLDER_NAME = attached
ALLOWED_IMAGE_EXTENSIONS = jpg, jpeg, png, webp, gif
ALLOWED_FILE_EXTENSIONS = txt, pdf, html, json, yaml, yml, conf, csv, cmd, bat, sh
```
## Usage
### Viewing Notes
- Navigate through your notes using the sidebar tree structure
- Click on any `.md` file to view its rendered content
- Images and links are automatically processed and displayed
### Creating Notes
- Click "New Note" or use Ctrl+N
- Enter a title and content using Markdown syntax
- Save with Ctrl+S or click the Save button
### Editing Notes
- Click the "Edit" button on any note
- Use the built-in editor with toolbar for common Markdown formatting
- Auto-save functionality and keyboard shortcuts available
### File Management
- Upload files by dragging and dropping or using the upload button
- Download any file by clicking the download icon
- Delete files and folders with confirmation dialogs
### Settings
- Access settings via the gear icon in the sidebar
- Configure image storage modes, file extensions, and directories
- Changes take effect immediately or after restart as indicated
## Development
### Project Structure
```
gobsidian/
├── cmd/
│ └── main.go # Application entry point
├── internal/
│ ├── config/ # Configuration management
│ ├── handlers/ # HTTP route handlers
│ ├── markdown/ # Markdown rendering
│ ├── models/ # Data models
│ ├── server/ # HTTP server setup
│ └── utils/ # Utility functions
├── web/
│ ├── static/ # CSS, JS, and static assets
│ └── templates/ # HTML templates
├── notes/ # Default notes directory
├── go.mod # Go module definition
└── settings.ini # Configuration file
```
### Building
To build a standalone binary:
```bash
# in case you change CSS or add some, recompile tailwind.css
wget https://github.com/tailwindlabs/tailwindcss/releases/download/v4.1.12/tailwindcss-linux-x64
chmod +x tailwindcss-linux-x64
./tailwindcss-linux-x64 -i ./web/static/tailwind.input.css -o ./web/static/tailwind.css --minify
```
```bash
go mod tidy
GOOS=linux GOARCH=amd64 go build -o gobsidian ./cmd
```
## Image storing trying to follow Obsidian settings
Image storing modes:
1. Mode 1 (Root directory):
- Images are stored directly in NOTES_DIR root
- In .md file: just filename like `![[image.png]]`
- When showing: serve from NOTES_DIR root
2. Mode 2 (Specific folder):
- Images stored in IMAGE_STORAGE_PATH
- In .md file: just filename like `![[image.png]]`
- When showing: serve from IMAGE_STORAGE_PATH
3. Mode 3 (Same as note):
- Images stored in same directory as the .md file
- In .md file: just filename like `![[image.png]]` (since it's in same dir)
- When showing: serve from note's directory
4. Mode 4 (Subfolder under note):
- Images stored in IMAGE_SUBFOLDER_NAME under note's directory
- In .md file: `![[<IMAGE_SUBFOLDER_NAME>/image.png]]`
- When showing: serve from note's directory/IMAGE_SUBFOLDER_NAME
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgments
- Inspired by Obsidian's excellent note-taking capabilities
- Built with Go, Gin, TailwindCSS, and highlight.js
- Thanks to the open source community for the excellent libraries used