Skip to content

Add Markdown and PDF field exports - #36

Merged
erinepshovel-code merged 1 commit into
mainfrom
agent/field-export-controls
Aug 3, 2026
Merged

erinepshovel-code merged 1 commit into
mainfrom
agent/field-export-controls

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Contributor

What changed

Every ordinary substantive text field now has one compact action group:

  • Copy copies visible field text.
  • .md downloads the field as a title-based Markdown file.
  • PDF opens a print-ready field view; choose Save as PDF in the browser dialog to download it.

Linked cards retain sibling controls, avoiding nested interactive elements. Four Cuts receives the same grouping.

Validation

  • npm test — 44/44 passed
  • JavaScript syntax checks — passed
  • git diff --check — passed

hmmm

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.

@erinepshovel-code
erinepshovel-code marked this pull request as ready for review August 3, 2026 06:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/assets/js/site.js

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>`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/assets/js/site.js

function downloadMarkdown(field) {
const link = document.createElement('a');
link.href = URL.createObjectURL(new Blob([`${textForCopy(field)}\n`], { type: 'text/markdown;charset=utf-8' }));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/assets/css/site.css
.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; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/assets/js/site.js

function fieldLabel(field) {
function fieldTitle(field) {
const heading = field.querySelector('h1, h2, h3, summary, strong');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize the Four Cuts field titles

The Four Cuts exportable measures identify themselves with .m-title elements rather than h1h3, 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 👍 / 👎.

@erinepshovel-code
erinepshovel-code merged commit ba26fb5 into main Aug 3, 2026
5 checks passed
erinepshovel-code added a commit that referenced this pull request Aug 4, 2026
…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.

Copy link
Copy Markdown
Contributor Author

Post-merge reconciliation completed in PR #37 and merged as 4576ce712684135f02ca72f88251f75dcd927ae6.

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 .m-title / .ref-title support for distinct Four Cuts labels and filenames. Manual audit additionally caught and repaired the case where the exported card itself is the link.

The original threads remain intact as historical evidence. GitHub Actions continued to fail before Set up job, with no steps, logs, or configured failure artifact; merge history records that as an unresolved execution boundary rather than a green gate claim.

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