Skip to content

Feat/answer link transformation - #288

Merged
sabinem merged 1 commit into
mainfrom
feat/answer-link-transformation
Sep 2, 2026
Merged

Feat/answer link transformation#288
sabinem merged 1 commit into
mainfrom
feat/answer-link-transformation

Conversation

@sabinem

@sabinem sabinem commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

A participant pastes their GitHub URL into a registration answer, and now anyone reading that answer can click it.

Before, they couldn't. Registration questions of the free-text kind are where people put an address — their repo, their portfolio, the paper they'd like to build on — and the answer was printed as flat text everywhere it appeared. An organizer going through fifty sign-ups had to select each URL and copy it into the address bar, one at a time. So did a participant reading a teammate's shared answers.

Answers now render through a single component. Text stays text; anything that is an http:// or https:// address becomes a link that opens in a new tab.

Details:

  • Four places changed, all of them reading the same component: your own profile and a peer's shared answers, the organizer's view of a single participant, and both lists on the organizer's registration-answers page (the folded "who said what" and the open free-text list). Previously each of these had its own copy of "print the value, saying Yes/No for a tick-box"; that logic now lives in one place.
  • The address as typed is also the visible text. Deliberate — it means an answer cannot show yourbank.com while pointing somewhere else, which is exactly the trick a linkifier that accepted a separate label would hand to anyone filling in a form.
  • Only http and https. Not "other schemes are rejected" but "other schemes are never candidates" — the matcher only looks for those two, so javascript:, data: and file: stay as the text they are.
  • No {@html} anywhere. The splitter returns a list of segments and Svelte renders and escapes them, so an answer containing <script> appears on the page as those characters. This is why the answers do not go through the existing markdown pipeline, even though it would have linkified them for free — see below.
  • Trailing punctuation goes to the sentence, not the URL: see https://x.dev/a. links without the full stop, and (https://en.wikipedia.org/wiki/Foo_(bar)) keeps its inner parens and drops the outer one.
  • Two of the four views put the answer in a flex flex-wrap row, where a flex item won't shrink below its content — a long pasted URL would have widened the whole row. They gained min-w-0 break-words.

Deliberately left out:

  • Markdown. Running answers through the app's existing markdown renderer would have made links clickable with almost no code, but nobody has told participants their answer is markdown — there's no editor, no help text, no preview. An answer of 5 * 3 * 2 = 30 would come out with emphasis in it, and a line beginning # 1 pick would become a heading. Organizer-written page content is markdown because its author knows it is.
  • Bare www.example.com and email addresses. Considered and dropped in favour of the narrowest rule that has no false positives. Easy to add later if people ask.
  • The CSV export is untouched — a URL there stays a plain string, which is what a spreadsheet wants.
  • The registration form says nothing about links. A pasted link just works, and a hint invites people to wonder what other formatting is on offer when the answer is "none".
  • Enum and boolean answers pass through the same component, where it's a no-op. One rule for how an answer prints beat two.

Registration questions are free text, and the useful thing people put in
one is an address — their repo, their portfolio, the paper they want to
work from. Every reader of those answers had to select the text and copy
it by hand, on their own profile, on an organizer's view of one person,
and on the page listing what the whole cohort said.

Answers now print through one component that splits the text into the
runs that are addresses and the runs that are not, and renders the first
as anchors. It produces segments rather than HTML, so nothing here goes
near `{@html}` and an answer cannot carry markup onto the page; only
`http`/`https` is ever recognised, so a `javascript:` string is never a
candidate for an href in the first place. The link text is the address as
typed, which is what stops an answer displaying one host while pointing
at another.

Not routed through the markdown pipeline on purpose: nobody told
participants their answer is markdown, and running it as such would
reformat answers that were never meant as markup.
@sabinem
sabinem force-pushed the feat/answer-link-transformation branch from cd7666b to 077081e Compare September 1, 2026 19:59
@sabinem
sabinem merged commit 8bd17b6 into main Sep 2, 2026
2 checks passed
@sabinem
sabinem deleted the feat/answer-link-transformation branch September 2, 2026 04:49
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