Repository navigation
Conversation
Add a "Copy as Markdown" button to the workout detail modal, behind the copy_markdown feature flag (default off, enable with ?ff=copy_markdown). - src/lib/workoutMarkdown.ts: pure renderer producing a GFM document with summary, notes, per-exercise set tables and optional feedback - 12 unit tests covering escaping, empty states, reps vs target, feedback - Uses the shared clipboard helper and toast; button is keyboard reachable with a visible focus ring Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
|
||
| /** Escape characters that would break a Markdown table cell. */ | ||
| function escapeCell(value: string): string { | ||
| return value.replace(/\|/g, '\\|').replace(/\r?\n/g, ' '); |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Copy as Markdown button to the workout detail modal (Progress → workout card). One click puts a GitHub-flavored Markdown version of the workout on the clipboard, ready to paste into notes, a chat or an issue.
Ships behind the
copy_markdownfeature flag, default off. Enable locally with?ff=copy_markdown.Changes
src/lib/workoutMarkdown.ts— pure renderer: heading with date, summary bullets (duration, sets, volume), notes as blockquote, one set table per exercise, optional feedback section. No DOM or DB access; exercise name lookup is injected.src/lib/workoutMarkdown.test.ts— 12 unit tests (escaping of|and newlines, no exercises, no completed sets, actual vs target reps, unknown exercise, feedback rendering).src/components/progress/WorkoutDetail.tsx— flag-gated button wired to the sharedcopyToClipboardhelper anduseToast; success and error toasts.src/components/progress/WorkoutDetail.css— outlined secondary button, footer gap, visible:focus-visiblering on both footer buttons.No new dependencies, no schema change, no network calls.
Verification
/verifyon this branch:Clipboard output for the seeded workout:
🤖 Generated with Claude Code