Skip to content

feat(commands): unify into :MdRender <subcommand> dispatcher#12

Merged
delphinus merged 1 commit into
mainfrom
feat/md-render-subcommand
May 12, 2026
Merged

feat(commands): unify into :MdRender <subcommand> dispatcher#12
delphinus merged 1 commit into
mainfrom
feat/md-render-subcommand

Conversation

@delphinus
Copy link
Copy Markdown
Owner

Closes #11.

Summary

  • Consolidate the 7 top-level commands into a single :MdRender <subcommand> dispatcher (float, tab, pager, toggle, split, auto on|off|toggle, demo), following the convention used by Trouble v3 / Telescope / Lazy
  • Two-level tab completion: subcommands on the first arg, on / off / toggle after auto. :vert MdRender split and other Vim modifiers compose naturally
  • Old commands (:MdRenderTab, :MdRenderToggle, :MdRenderSplit, :MdRenderAuto, :MdRenderPager, :MdRenderDemo) stay registered as deprecated aliases that forward to the dispatcher and emit a one-shot `vim.notify_once` warning per session. Slated for removal in a future major version
  • <Plug> mappings unchanged — they bind to functions, not commands, so user keymaps don't break
  • Vimdoc restructured: single *:MdRender* block with new *:MdRender-{float,tab,toggle,split,auto,pager,demo}* sub-tags, plus deprecated stub blocks so :help :MdRenderToggle still resolves
  • README (English + Japanese) command tables and narrative updated, with a backwards-compatibility note

Design notes

Per the issue's open questions (confirmed before implementation):

  • Two-level completion implemented, not just first-arg
  • :MdRender demo kept as a public subcommand (not hidden)
  • No named args (width=120 etc.) this round — open question deferred to a follow-up
  • Deprecation warning lands now (this release); old commands will be removed in v4.0.0

The dispatcher lives in a new `lua/md-render/command.lua` module rather than inline in `plugin/md-render.lua` so it's unit-testable (the Makefile runs tests with `--noplugin`).

The repo has no `CHANGELOG.md` (release notes live in git commits and GitHub releases), so the issue's CHANGELOG line is dropped.

Test plan

  • `make test` — 500 passed / 0 failed (35 new in `tests/command_test.lua` + 465 existing)
  • Headless smoke test: 7 commands register, completion returns expected lists for empty / `auto` / `:vert MdRender` cases, deprecation warning fires exactly once per session via real `vim.notify_once`
  • Manual smoke in interactive Neovim against `assets/showcase.md`: `:MdRender`, `:MdRender float`, `:MdRender tab`, `:MdRender pager`, `:MdRender toggle`, `:MdRender split`, `:vert MdRender split`, `:tab MdRender split`, `:MdRender auto on/off/toggle`, `:MdRender demo`
  • Tab completion in interactive Neovim: `:MdRender `, `:MdRender auto `, `:vert MdRender `
  • Each old command (`:MdRenderToggle`, `:MdRenderSplit`, `:MdRenderAuto on`, …) still works and prints the one-shot deprecation warning the first time it's used
  • `:help :MdRender`, `:help :MdRenderToggle`, `:help :MdRender-split` resolve correctly

🤖 Generated with Claude Code

Consolidate the 7 top-level commands (:MdRender, :MdRenderTab,
:MdRenderToggle, :MdRenderSplit, :MdRenderAuto, :MdRenderPager,
:MdRenderDemo) into one :MdRender command with subcommands and two-level
tab completion, following the convention used by Trouble v3, Telescope,
and Lazy. The old commands remain registered as deprecated aliases that
forward to the dispatcher and emit a one-shot vim.notify_once warning per
session; they will be removed in a future major version.

Closes #11.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@delphinus delphinus merged commit b12177a into main May 12, 2026
4 checks passed
@delphinus delphinus deleted the feat/md-render-subcommand branch May 12, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to subcommand-based command structure (:MdRender <sub>)

1 participant