Linux command
gh-preview 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Preview a markdown file
gh markdown-preview [README.md]
Preview in dark mode
gh markdown-preview --dark-mode [file.md]
Preview on a specific port
gh markdown-preview --port [8080] [file.md]
Preview without auto-opening
gh markdown-preview --disable-auto-open [file.md]
说明
gh markdown-preview is a GitHub CLI extension that starts a local web server to preview Markdown files with GitHub-accurate rendering. It uses the GitHub Markdown API and CSS extracted from the GitHub website to produce output that looks exactly as it will appear on GitHub. The extension supports live reloading, so edits to the file are reflected in the browser automatically. If no file is specified, it detects and opens the README in the current directory. Install with: gh extension install yusukebe/gh-markdown-preview.
参数
- --dark-mode
- Force dark mode rendering.
- --light-mode
- Force light mode rendering.
- -p, --port _port_
- TCP port for the local server (default: 3333).
- --host _hostname_
- Hostname to bind the server to (default: localhost).
- --disable-auto-open
- Do not automatically open the browser.
- --disable-reload
- Disable live reloading on file changes.
- --verbose
- Show verbose output.
- --version
- Show version.
FAQ
What is the gh-preview command used for?
gh markdown-preview is a GitHub CLI extension that starts a local web server to preview Markdown files with GitHub-accurate rendering. It uses the GitHub Markdown API and CSS extracted from the GitHub website to produce output that looks exactly as it will appear on GitHub. The extension supports live reloading, so edits to the file are reflected in the browser automatically. If no file is specified, it detects and opens the README in the current directory. Install with: gh extension install yusukebe/gh-markdown-preview.
How do I run a basic gh-preview example?
Run `gh markdown-preview [README.md]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --dark-mode do in gh-preview?
Force dark mode rendering.