Skip to content

Add flags to embed screenshots into markdown - #519

Draft
qu1queee wants to merge 4 commits into
homeport:mainfrom
qu1queee:add/embed-markdown
Draft

qu1queee wants to merge 4 commits into
homeport:mainfrom
qu1queee:add/embed-markdown

Conversation

@qu1queee

@qu1queee qu1queee commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

Some learning docs would ideally let the reader run a CLI and watch it work. When that CLI is an AI assistant, that is not possible: every reader cannot use the author's assistant, and there is no shared sandbox to run the agent.

termshot is the stand-in. Capture what the terminal looks like once, commit the PNG, and show it in markdown. Readers get a predefined screenshot instead of a live session.

--embed is for maintaining those docs: regenerate the PNG and update the matching image slot in the markdown file in one command, instead of running termshot and then editing image references by hand.

Summary

  • Add mdembed to update screenshot image references at <!-- termshot:id=... --> markers.
  • Add --embed, --id, and --alt so one termshot run writes the PNG and updates the markdown image link.
  • Document the flags, add markers to this README, and update .doc/create-termshots.sh.

Test plan

  • ginkgo run ./internal/mdembed/
  • termshot --filename /tmp/ls.png --embed README.md --id example-ls-a -- ls -a updates the matching README slot
  • Missing --id or missing marker fails before the command runs
  • --embed with --raw-write is rejected

qu1queee and others added 4 commits September 15, 2026 18:38
Introduce `mdembed` to update screenshot image references in markdown
files using `<!-- termshot:id=... -->` markers.

Introduce test cases for `mdembed` package.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add `--embed`, `--id`, and `--alt` to write a PNG and update the matching
markdown marker in one step.

Fail early if the marker is missing or `--embed` is combined with
`--raw-write`.

Co-authored-by: Cursor <cursoragent@cursor.com>
Describe `--embed`, `--id`, and `--alt` in the README.

Add embed markers to existing screenshots and update the example
generation script.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ignore path taint reports for the user-provided markdown embed target
and the temp file used in tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant