Skip to content

aXisho/glmo

 
 

Repository files navigation

glmo

glmo is a Gloss Markdown viewer that opens .md and .gloss.md files in a browser.

A fork of k1LoW/mo with Gloss Markdown support added.

Features

  • Gloss Markdown support — renders .gloss.md directives (callouts, tabs, badges, etc.)
  • GitHub-flavored Markdown (tables, task lists, footnotes, etc.)
  • Syntax highlighting (Shiki)
  • Mermaid diagram rendering
  • LaTeX math rendering (KaTeX)
  • GitHub Alerts (admonitions)
  • Fullscreen zoom modal for images and Mermaid diagrams
  • dark theme Dark / light theme light theme
  • group File grouping
  • toc Table of contents panel
  • flat view Flat / tree view tree sidebar view with drag-and-drop reorder
  • file name File name / heading title heading title sidebar display toggle (per-group)
  • search Full-text search across file names and content
  • YAML frontmatter display (collapsible metadata block)
  • MDX file support (renders as Markdown, strips import/export, escapes JSX tags)
  • font size Content font size toggle (small / medium / large / extra large)
  • wide view Wide / narrow view narrow content width toggle
  • raw Raw markdown view
  • copy Copy content (Markdown / Text / HTML)
  • restart Server restart with session preservation
  • Auto session backup and restore
  • Drag-and-drop file addition from the OS file manager (content is loaded in-memory; live-reload is not supported for dropped files)
  • Stdin pipe support (cat file.gloss.md | glmo)
  • Live-reload on save (for files opened via CLI)

Install

manually:

Download binary from releases page or build from source (see below).

Usage

$ glmo README.md                          # Open a single file
$ glmo README.md CHANGELOG.md docs/*.md   # Open multiple files
$ glmo docs/                              # Open all .md / .gloss.md files in a directory
$ glmo spec.gloss.md --target design      # Open a Gloss Markdown file in a named group
$ cat notes.gloss.md | glmo               # Read from stdin

glmo opens Markdown and Gloss Markdown files in a browser with live-reload. When you save a file, the browser automatically reflects the changes. .gloss.md files are rendered with Gloss Markdown directives (callouts, tabs, badges, etc.).

Gloss Markdown files

.gloss.md files are automatically detected and rendered with Gloss Markdown support:

$ glmo spec.gloss.md          # Renders Gloss Markdown directives
$ glmo -w '**/*.gloss.md'     # Watch all .gloss.md files

Reading from stdin

When no positional arguments are given and stdin is redirected (not a terminal), glmo reads Markdown content from stdin.

$ cat notes.md | glmo
$ some-command | glmo --target output
$ glmo < notes.gloss.md

The content is loaded in-memory with a generated name (stdin-<hash>.md). Piping the same content again reuses the existing entry (deduplicated by content hash).

Single server, multiple files

By default, glmo runs a single server on port 6275. If a server is already running on the same port, subsequent glmo invocations add files to the existing session instead of starting a new one.

$ glmo README.md          # Starts a glmo server in the background
$ glmo CHANGELOG.md       # Adds the file to the running glmo server

To run a completely separate session, use a different port:

$ glmo draft.md -p 6276

Multiple files with sidebar

Groups

Files can be organized into named groups using the --target (-t) flag. Each group gets its own URL path and sidebar.

$ glmo spec.md --target design      # Opens at http://localhost:6275/design
$ glmo api.md --target design       # Adds to the "design" group
$ glmo notes.md --target notes      # Opens at http://localhost:6275/notes

Group view

Watch mode and glob patterns

--watch (-w) turns on watch mode. Directory and glob positional arguments are registered as watch patterns, matching files are opened, and new matching files are picked up automatically.

$ glmo -w '**/*.md'                              # Watch and open all .md files recursively
$ glmo -w '**/*.gloss.md'                        # Watch all .gloss.md files
$ glmo -w 'docs/**/*.md' --target docs           # Watch docs/ tree in "docs" group
$ glmo -w '*.md' 'docs/**/*.md'                  # Multiple patterns (positional)
$ glmo -w docs/                                  # Watch docs/*.md

Combine with --recursive (-R) to descend into subdirectories. Short flags can be combined:

$ glmo -w -R docs/                               # Watch docs/**/*.md
$ glmo -wR docs/                                 # Same, short-combined

Without --watch, globs are expanded once and directory arguments open matching files without live-watching new additions:

$ glmo docs/                                     # Open every .md directly in docs/
$ glmo -R docs/                                  # Open every .md under docs/ (recursive)
$ glmo 'docs/*.md'                               # Expand and open matching .md files

Removing watch patterns

--unwatch removes previously registered patterns. Pass glob patterns or directories as positional arguments to specify which patterns to remove. Regular file paths are not accepted (use --close to remove individual files from the sidebar). Files already added by a pattern remain in the sidebar.

$ glmo --unwatch '**/*.md'                              # Stop watching a pattern (default group)
$ glmo --unwatch docs/                                  # Stop watching docs/*.md
$ glmo --unwatch 'docs/**/*.md' --target docs            # Stop watching in a specific group

With -R, a directory argument removes all registered patterns under that directory at once. For example, if docs/*.md, docs/sub/*.md, and docs/**/*.md are all registered, a single command removes them all:

$ glmo --unwatch -R docs/                               # Removes docs/*.md, docs/sub/*.md, docs/**/*.md, etc.

Patterns are resolved to absolute paths before matching, so you can specify either a relative glob or the full path shown by --status.

Sidebar view modes

The sidebar supports flat and tree view modes. Flat view shows file names only, while tree view displays the directory hierarchy.

Flat Tree
Flat view Tree view

Starting and stopping

glmo runs in the background by default — the command returns immediately, leaving the shell free for other work. This makes it easy to incorporate into scripts, tool chains, or LLM-driven workflows.

$ glmo README.md
glmo: serving at http://localhost:6275 (pid 12345)
$ # shell is available immediately

Use --status to check all running glmo servers, and --shutdown to stop one:

$ glmo --status              # Show all running glmo servers
http://localhost:6275 (pid 12345, v0.1.0)
  default: 5 file(s)
    watching: /Users/you/project/src/**/*.md, /Users/you/project/*.md
  docs: 2 file(s)
    watching: /Users/you/project/docs/**/*.md

$ glmo --shutdown            # Shut down the glmo server on the default port
$ glmo --shutdown -p 6276    # Shut down the glmo server on a specific port
$ glmo --restart             # Restart the glmo server on the default port

If you need the glmo server to run in the foreground (e.g. for debugging), use --foreground:

$ glmo --foreground README.md

Server restart

Click the restart restart button (bottom-right corner) or run glmo --restart to restart the glmo server process. The current session — all open files and groups — is preserved across the restart.

Session backup and restore

glmo automatically saves session state (open files and watch patterns per group) when files are added or removed. When starting a new server, the previous session is automatically restored and merged with any files specified on the command line.

$ glmo README.md CHANGELOG.md       # Start with two files
$ glmo --shutdown                   # Shut down the server
$ glmo                              # Restores README.md and CHANGELOG.md
$ glmo TODO.md                      # Restores previous session + adds TODO.md

Use --close to remove specific files from the running server:

$ glmo --close README.md            # Close a file from the default group
$ glmo --close docs/*.md -t docs    # Close files from the "docs" group

Use --clear to remove a saved session. If a server is running, it is automatically restarted with an empty state:

$ glmo --clear                      # Clear saved session for the default port
$ glmo --clear -p 6276              # Clear saved session for a specific port

JSON output

Use --json to get structured JSON output on stdout, useful for scripting and integration with other tools.

$ glmo --json README.md
{
  "url": "http://localhost:6275",
  "files": [
    {
      "url": "http://localhost:6275/?file=a1b2c3d4",
      "name": "README.md",
      "path": "/Users/you/project/README.md"
    }
  ]
}

--status also supports --json:

$ glmo --status --json
[
  {
    "url": "http://localhost:6275",
    "status": "running",
    "pid": 12345,
    "version": "0.1.0",
    "revision": "abc1234",
    "groups": [
      {
        "name": "default",
        "files": 3,
        "patterns": ["**/*.md"]
      }
    ]
  }
]

Flags

Flag Short Default Description
--target -t default Group name
--port -p 6275 Server port
--bind -b localhost Bind address (e.g. 0.0.0.0)
--open Always open browser
--no-open Never open browser
--status Show all running glmo servers
--watch -w false Treat directory and glob arguments as watch patterns
--unwatch false Remove watched patterns for the given directory or glob arguments
--recursive -R false Recurse into subdirectories when a directory is given
--close Close files instead of opening them
--shutdown Shut down the running glmo server
--restart Restart the running glmo server
--clear Clear saved session (restarts server if running)
--foreground Run glmo server in foreground
--json Output structured data as JSON to stdout
--dangerously-allow-remote-access Allow remote access without authentication (trusted networks only)

Warning

Binding to a non-localhost address exposes glmo to the network without any authentication. Remote clients can read any file accessible by the user, browse the filesystem via glob patterns, and shut down the server. A confirmation prompt is shown when --bind is set to a non-loopback address.

Build

Requires Go 1.26+ and pnpm.

$ make build

The resulting binary is named glmo. To rename the binary during build:

$ go build -o glmo .

References

License

About

cuemo is a fork of mo with Cue Markdown support added.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages

  • TypeScript 51.4%
  • Go 42.7%
  • CSS 4.3%
  • JavaScript 1.2%
  • Other 0.4%