Add Markdown and PDF field exports - #36
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f933af7540
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const title = fieldTitle(field); | ||
| printWindow.document.open(); | ||
| printWindow.document.write(`<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${escapeHtml(title)}</title><style>body{max-width:50rem;margin:2rem auto;padding:0 1rem;color:#111;font:12pt/1.5 system-ui,sans-serif}h1{font-family:Georgia,serif;font-size:20pt;line-height:1.2}pre{white-space:pre-wrap;font:inherit}</style></head><body><h1>${escapeHtml(title)}</h1><pre>${escapeHtml(textForCopy(field))}</pre></body></html>`); |
There was a problem hiding this comment.
Avoid duplicating field headings in PDF exports
When the exported field contains an h1, h2, h3, summary, or strong, fieldTitle(field) extracts that text, but textForCopy(field) still includes the same element. The generated print view therefore renders the heading once as the synthetic <h1> and again at the beginning of <pre>, so most panel, card, and page-head PDF exports contain a visibly duplicated title. Exclude the selected heading from the body or omit the synthetic heading.
Useful? React with 👍 / 👎.
|
|
||
| function downloadMarkdown(field) { | ||
| const link = document.createElement('a'); | ||
| link.href = URL.createObjectURL(new Blob([`${textForCopy(field)}\n`], { type: 'text/markdown;charset=utf-8' })); |
There was a problem hiding this comment.
Preserve field structure in Markdown downloads
For fields containing links, headings, or lists, textForCopy(field) returns only rendered innerText, so the downloaded .md discards all Markdown structure and link destinations. This is especially visible for linked project, article, and chapter cards: their export contains the label and description but no URL back to the linked resource. Serialize the field semantics into Markdown rather than placing the clipboard-oriented plain-text representation in a Markdown-named blob.
Useful? React with 👍 / 👎.
| .copy-field-link { position: relative; min-width: 0; } | ||
| .copy-field-link > .card { height: 100%; } | ||
| .copy-field-link > .copy-button { position: absolute; z-index: 2; top: .75rem; right: .75rem; float: none; margin: 0; } | ||
| .copy-field-link > .field-actions { position: absolute; z-index: 2; top: .75rem; right: .75rem; float: none; margin: 0; } |
There was a problem hiding this comment.
Reserve card space for the expanded action group
On linked cards, the three-button group is absolutely positioned over the card without adding any top or right padding to the underlying anchor. At the grid's narrow column sizes, this substantially wider group occupies the same top row as status badges and chapter numbers, obscuring those elements and making their covered portion unclickable as a card link. Reserve layout space in .card or place the group outside the card's content area.
Useful? React with 👍 / 👎.
|
|
||
| function fieldLabel(field) { | ||
| function fieldTitle(field) { | ||
| const heading = field.querySelector('h1, h2, h3, summary, strong'); |
There was a problem hiding this comment.
Recognize the Four Cuts field titles
The Four Cuts exportable measures identify themselves with .m-title elements rather than h1–h3, summary, or strong, so fieldTitle() falls back to the page title for every measure. As a result, all four distinct measure exports receive the same filename, PDF heading, and accessible action labels, making downloaded files indistinguishable except for browser-added numeric suffixes. Include the artifact's .m-title and .ref-title vocabulary when resolving field titles.
Useful? React with 👍 / 👎.
…ew-reconciliation fix(site): reconcile post-merge export and Gonol receipt defects Repairs the eleven unresolved findings carried forward from PRs #35 and #36. Preserves the GitHub Actions pre-step execution failure as an operational boundary rather than representing it as successful repository validation.
|
Post-merge reconciliation completed in PR #37 and merged as The replacement repair addresses all four unresolved findings from this PR: structure-preserving Markdown with link destinations, non-duplicated PDF headings, reserved linked-card action space, and The original threads remain intact as historical evidence. GitHub Actions continued to fail before |
What changed
Every ordinary substantive text field now has one compact action group:
Linked cards retain sibling controls, avoiding nested interactive elements. Four Cuts receives the same grouping.
Validation
npm test— 44/44 passedgit diff --check— passedhmmm
The emergency fallback remains intentionally dependency-free and therefore has no JavaScript export controls. A local rendered-site rebuild was blocked by an external textbook-refresh timeout; CI is the authoritative full build and browser gate.