mdp — markdown preview pane
The bundled mdp command splits the current Herdr pane to the right and runs Glow's viewer
in the new pane. The preview live-reloads when the file changes, and q closes the
pane. The command returns immediately, so it does not block this session.
Arguments: $ARGUMENTS
Workflow
Check for Herdr. Run
test "${HERDR_ENV:-}" = 1. If it fails, tell the user the preview needs Herdr and stop. Never runmdporglowoutside Herdr: theremdpfalls back to starting Glow's full-screen viewer in the current terminal, which would hang the Bash tool.Resolve the target.
- If arguments were given, use them as the path (relative to the current working
directory). A directory is fine;
mdpopens Glow's file browser for it. - If there are no arguments, use the markdown file this conversation most recently created, edited, or discussed. If there is no clear single candidate, ask the user which file rather than guessing.
- If the path does not exist, say so and stop.
- If arguments were given, use them as the path (relative to the current working
directory). A directory is fine;
Open it. Run
mdp "<path>"once. Quote the path, since filenames may contain spaces. Do not open a second preview of the same file unless asked.Confirm in one line, e.g. "Opened
notes.mdin the pane on the right. It updates as the file changes; pressqthere to close it." Nothing more.
Notes
- The new pane takes focus. To return to this session, the user switches panes in Herdr.
- Glow cannot render images or Mermaid diagrams. For files that depend on them, mention that opening the file in a browser or an editor with a Mermaid-capable preview is the fallback.