Repository navigation
feat(social): postMarkdown() and threadMarkdown() write fetched posts as Markdown - #505
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
comark-annotate
comark-badge
comark-bundle
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chat
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-comments
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-git-graph
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-magic-move
comark-mark
markdown-it-to-comark
marked-to-comark
comark-mathml
comark-media
comark-metrics
migrate-to-comark
comark-motion
comark-outline
comark-properties
comark-qr
comark-quiz
comark-reading-time
remark-to-comark
comark-social
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-time
comark-ui
comark-xref
comark-zoom
commit: |
There was a problem hiding this comment.
Important
Two serialization bugs can change what an unfetched card displays: a text link can become an image, and a real photo can disappear because of its alt text.
Approach: Serializing to the existing ::post and ::thread blocks is the right fit for hosts that render without fetching, but the output needs to preserve links and pictures through the Markdown parser.
Reviewed changes — Traced the new public helpers from fetched data through Markdown parsing and HTML rendering. The workspace build and 94 focused tests passed; targeted round-trip checks reproduced both findings inline.
- Serialization: Reviewed
postMarkdown(),threadMarkdown(), andtextMarkdown(), including nesting, quote handling, and picture URL rewrites. - Rendering: Reviewed the written
{video}path and compared static cards with cards rendered from stubbed platform responses. - Documentation: Checked the public examples and agent reference against the new API.
gpt-6.2-sol(high) | 𝕏
Latest result Pull request merged. Final answersSession Pull request merged. Session CI reconciliation completed; model work is waiting for host admission. |
There was a problem hiding this comment.
ℹ️ No new P0 or P1 findings. The existing alt-text round-trip thread remains open.
Reviewed changes — Reviewed d7018af against the prior review. The full preset built successfully, and all 98 focused social, preset, and linter tests passed.
- Escaped punctuation before generated links. Verified that an adjacent
!stays visible and the URL renders as a link rather than an image. - Changed how image descriptions are serialized and read back. Verified that the original cases involving brackets, mixed quotes, trailing backslashes, and embedded newlines now match the fetched card.
gpt-6.2-sol(high) | 𝕏

Drop renders documents without fetching, so a script that fetched a post with
fetchPost()has to write the::postMarkdown itself. Today it copies the props, the escaping, and the fence rules by hand, and one missed escape breaks a card. comark-social now does it.What changed
postMarkdown(post, { src, colons })returns the::postMarkdown for whatfetchPost()returns, or the same shape written by hand.threadMarkdown(posts, { src, colons, focal })returns the::threadMarkdown for a thread's posts, root first, each written aspostMarkdown()writes it.textMarkdown(text)escapes plain text the same way, for a host that writes text into a block of its own.{video}as a video still (.csl-video), which is what the fetch path draws for a video. Without this, a written card had no way to say a picture was a video.Decisions
::post{url}withfetchon and renderspostMarkdown()of the same post unfetched, then compares the HTML byte for byte. That covers the X, Bluesky, and Mastodon fixtures and a list of adversarial texts, with social alone and with the whole comark-ui preset. Links therefore read as the fetch path shows them: no scheme, cut after 30 characters.". When it holds both quotes, a backslash, or a line break, it's written as a:key='…'JSON binding, because Comark's quoted values have no escapes.{,],:name,::,`,*,$,@after a character,://, and a#,-,>,1.,=or:at the start of a line. Spaces at the ends of a line are written as entities, so the text comes back as it went in.\and[are written as\and[, because comark-mathml reads\[as display math even after an escaped backslash. A link's address is percent-encoded where Markdown links are, which reads the same but isn't byte-equal.srcis async and per picture.src(url, { kind, index, post })covers both the avatar and the pictures, so a script can save each file and write./A.png, as Drop's publishimagesexpects. Returningundefinedkeeps the address.platformis written only when the address doesn't already say it.colonsopens the block deeper, so a post can go inside another block. The quoted post is always one colon deeper.threadMarkdown()takes the posts, not an address. comark-social has no thread fetcher of its own (the walk is inside the plugin), so the docs show the five-linereplyToloop that builds the list. Each post's quote goes one colon deeper than the post, andsrcgets the post with each picture, so a script can name files per post. The test fetches a Mastodon thread both ways and compares the HTML.How it was checked
comark-social: 39 tests intest/markdown.test.ts, including the X, Bluesky, and Mastodon fixtures and a fetched Mastodon thread, each rendered both ways and compared byte for byte. The package's other suites pass too (85 tests in all).comark-ui:test/social-markdown.test.tsrenders eight adversarial texts through the whole HTML preset (math, mark, keys, critic, footnotes, cite, time, icon, qr, deflist, callouts, code groups, mentions, references, chips, and CJK emphasis) both ways, and compares the HTML.comark-linter's social tests pass.vp fmt,vp check,pnpm typecheck, the social build with publint,pnpm --filter comark-social run doctor(0 warnings), andpnpm run lint:docsall pass.Plan: https://drop.vitehub.dev/d/wtn1zg3tajmt/social-poll-drop-plan
🤖 Generated with Claude Code