|
26 | 26 | ) |
27 | 27 |
|
28 | 28 | var rootCmd = &cobra.Command{ |
29 | | - Use: "mo [flags] [FILE ...]", |
30 | | - Short: "mo is a Markdown viewer that opens .md files in a browser.", |
| 29 | + Use: "mo [flags] [FILE ...]", |
| 30 | + Short: "mo is a Markdown viewer that opens .md files in a browser.", |
| 31 | + Long: `mo is a Markdown viewer that opens .md files in a browser with live-reload. |
| 32 | +
|
| 33 | +It starts an HTTP server, renders Markdown files using a built-in React SPA, |
| 34 | +and automatically refreshes the browser when files are saved. |
| 35 | +
|
| 36 | +Examples: |
| 37 | + mo README.md Open a single file |
| 38 | + mo README.md CHANGELOG.md docs/*.md Open multiple files |
| 39 | + mo spec.md --target design Open in a named group |
| 40 | + mo draft.md --port 6276 Use a different port |
| 41 | +
|
| 42 | +Single Server, Multiple Files: |
| 43 | + By default, mo runs a single server process on port 6275. |
| 44 | + If a server is already running on the same port, subsequent mo invocations |
| 45 | + add files to the existing session instead of starting a new one. |
| 46 | +
|
| 47 | + $ mo README.md # Starts a server and opens the browser |
| 48 | + $ mo CHANGELOG.md # Adds the file to the running server |
| 49 | +
|
| 50 | + To run a completely separate session, use a different port: |
| 51 | +
|
| 52 | + $ mo draft.md -p 6276 |
| 53 | +
|
| 54 | +Groups: |
| 55 | + Files can be organized into named groups using the --target (-t) flag. |
| 56 | + Each group gets its own URL path (e.g., http://localhost:6275/design) |
| 57 | + and its own sidebar in the browser. |
| 58 | +
|
| 59 | + $ mo spec.md --target design # Opens at /design |
| 60 | + $ mo api.md --target design # Adds to the "design" group |
| 61 | + $ mo notes.md --target notes # Opens at /notes |
| 62 | +
|
| 63 | + If no --target is specified, files are added to the "default" group. |
| 64 | +
|
| 65 | +Live-Reload: |
| 66 | + mo watches all opened files for changes using filesystem notifications. |
| 67 | + When a file is saved, the browser automatically re-renders the content. |
| 68 | +
|
| 69 | +Supported Markdown Features: |
| 70 | + - GitHub Flavored Markdown (tables, task lists, strikethrough, autolinks) |
| 71 | + - Syntax-highlighted code blocks (via Shiki) |
| 72 | + - Mermaid diagrams |
| 73 | + - Raw HTML`, |
31 | 74 | Args: cobra.ArbitraryArgs, |
32 | 75 | RunE: run, |
33 | 76 | Version: version.Version, |
|
0 commit comments