Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ This project is a reimplementation of the original Python-based [grip](https://g
- [x] Todo list like the one on GitHub
- Support for github markdown emojis :+1: :bowtie:
- Support for mermaid diagrams
- 🌍 **Enhanced multilingual print support** - optimized for global languages including Chinese, Japanese, Korean, Arabic, Hindi, and more
- 🖨️ **Professional print layout** - optimized margins, typography, and page breaks for high-quality printing

```mermaid
graph TD;
Expand Down Expand Up @@ -85,12 +87,41 @@ It's also possible to activate the darkmode:
go-grip -d .
```

To disable automatic browser reload on file changes (useful for stable editing):

```bash
go-grip --no-reload README.md
```

To terminate the current server simply press `CTRL-C`.

## :pencil: Examples

<img src="./.github/docs/example-1.png" alt="examples" width="1000"/>

## :printer: Print Features

**go-grip** now includes comprehensive print optimization for global users:

### Multilingual Font Support
- **East Asian**: Chinese (Simplified/Traditional), Japanese, Korean
- **South Asian**: Hindi, Tamil, Bengali, and other Indic languages
- **Middle Eastern**: Arabic, Hebrew with proper RTL support
- **European**: Latin, Cyrillic scripts (Russian, Ukrainian, etc.)
- **Southeast Asian**: Thai, Khmer, and more

### Print Layout Optimization
- **Smart margins**: Left 2cm (binding edge), others 1.5cm
- **Professional typography**: Optimized font sizes and line spacing
- **Page break control**: Prevents awkward splits in tables, code blocks
- **Clean backgrounds**: Removes backgrounds while preserving colors
- **URL printing**: Shows link destinations for reference

### Usage
1. Open any markdown file with `go-grip filename.md`
2. Use browser's print function (`Ctrl+P` / `Cmd+P`)
3. Enjoy high-quality multilingual printouts!

## :bug: Known TODOs / Bugs

- [ ] Tests and refactoring
Expand Down
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ var rootCmd = &cobra.Command{
host, _ := cmd.Flags().GetString("host")
port, _ := cmd.Flags().GetInt("port")
boundingBox, _ := cmd.Flags().GetBool("bounding-box")
noReload, _ := cmd.Flags().GetBool("no-reload")

var file string
if len(args) == 1 {
file = args[0]
}

parser := pkg.NewParser(theme)
server := pkg.NewServer(host, port, theme, boundingBox, browser, parser)
server := pkg.NewServer(host, port, theme, boundingBox, browser, !noReload, parser)
return server.Serve(file)
},
}
Expand All @@ -42,4 +43,5 @@ func init() {
rootCmd.Flags().StringP("host", "H", "localhost", "Host to use")
rootCmd.Flags().IntP("port", "p", 6419, "Port to use")
rootCmd.Flags().Bool("bounding-box", true, "Add bounding box to HTML")
rootCmd.Flags().Bool("no-reload", false, "Disable automatic browser reload on file changes")
}
20 changes: 20 additions & 0 deletions defaults/static/css/github-mermaid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Mermaid error and utility styles */
.mermaid-error {
background: #fff0f0;
color: #cf222e;
border: 1px solid #cf222e;
border-radius: 6px;
padding: 8px 12px;
margin: 8px 0;
white-space: pre-wrap;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
font-size: 12px;
}

@media (prefers-color-scheme: dark) {
.mermaid-error {
background: #2a1616;
color: #ff7b72;
border-color: #da3633;
}
}
Loading