Skip to content

Name a pasted link after its page (paste title) #681

Open

Description

@HMarzban

Problem

A pasted link keeps its long address as its text. Readers then see https://github.com/oven-sh/bun?tab=readme-ov-file#install where oven-sh/bun would do. Many editors swap the address for the page title. docs.plus did not, and the hyperlink extension gave other Tiptap hosts no way to do it.

What was built

Extension (@docs.plus/extension-hyperlink)

  • A new pasteTitle: { fetchTitle, shouldFetch? } option. The host connects it to its own backend. Unset means off, and the package makes no request of its own.
  • A pasted bare URL becomes a link at once, with the URL as its text. The title replaces it when fetchTitle answers. With no answer in 4 s, the URL stays.
  • The swap is its own undo step: one Mod-z restores the URL, under prosemirror-history and under Yjs. Mod-Shift-v pastes the raw URL.
  • The engine cleans every title: it strips control and bidi characters, cuts at 120 graphemes, and refuses invisible text and look-alike addresses (Keep look-alike addresses out of pasted link titles #682).
  • At most 5 runs per editor. Each run owns one AbortController and one deadline, and destroy ends them all.

docs.plus

  • Live pads only. Chat, history and /editor keep the URL. Links to other pads keep the URL in this build (Name pasted docs.plus pad links after their pad #680).
  • Settings › Appearance › Link previews gains "Use page titles for pasted links". It is on by default, stored per browser, and applies only while signed in. linkPreviewOn is now the one rule for both link-preview switches.
  • The privacy page says a pasted link goes to our server, like a link preview. LEGAL_UPDATED is 4 November 2026.
  • A file link takes its decoded file name with its format, such as Q3 Report.pdf (maintainer ruling, 2026-11-04).

Where the code lives

Part Files
Engine extensions/extension-hyperlink/src/paste-title/pasteTitle.ts, cleanTitle.ts, types.ts
Option, storage, onTransaction, onDestroy extensions/extension-hyperlink/src/hyperlink.ts
Developer guide extensions/extension-hyperlink/docs/paste-title.md
docs.plus resolver apps/webapp/src/components/TipTap/hyperlinkPopovers/padPasteTitle.ts
Pad-only wiring apps/webapp/src/components/TipTap/TipTap.tsx (pasteTitle: provider ? padPasteTitle : undefined)
Switch and the signed-in rule apps/webapp/src/stores/linkPreviewStore.ts (pasteTitles, linkPreviewOn)
Settings row apps/webapp/src/components/settings/components/AppearanceSection.tsx, SettingsPanelSkeleton.tsx
Privacy text apps/webapp/src/pages/privacy.tsx
File-name title apps/hocuspocus.server/src/modules/link-metadata/domain/stages/htmlScrape.ts (filenameFromUrl)
House rules apps/webapp/CLAUDE.md §Paste title, extensions/extension-hyperlink/AGENTS.md §Paste title

Commits

  • 5faf3580d feat(extension-hyperlink): name pasted links after their page
  • 7282bd22a feat(webapp): show page titles for links pasted in a pad
  • 2ec2130b4 fix(link-metadata): decode the file name in a file link title

How to test

  • Extension unit tests: cd extensions/extension-hyperlink && bun test src/paste-title.
  • Extension Cypress (13 cases, each proved by sabotage): cd extensions/extension-hyperlink && env -u ELECTRON_RUN_AS_NODE bunx start-server-and-test playground http://127.0.0.1:5173 'bunx cypress run --browser chrome --spec cypress/e2e/paste-title.cy.ts'.
  • Real-pad undo under y-undo: apps/webapp/cypress/e2e/document/paste-title.cy.ts. It stays out of CI by maintainer ruling, because it needs make dev-local. The command is in apps/webapp/CLAUDE.md §Paste title. Run it on every Tiptap or y-tiptap upgrade.
  • Checked in two browsers on 2026-11-04: the title shows in both tabs, the first undo restores the URL, and the second removes the paste.

Production check, after the deploy

  1. Open a pad you can edit, for example a new one from https://docs.plus/new.
  2. Copy https://github.com/oven-sh/bun and paste it alone into an empty line.
  3. Expected: the link shows the address at once, then reads oven-sh/bun within about a second.
  4. Press ⌘Z: the address comes back. Press ⌘Z again: the paste goes.
  5. Paste with ⌘⇧V: the address stays, with no title.
  6. Paste https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf: it reads dummy.pdf.

If the title never comes, open the browser network panel. Look for GET /api/metadata?url=… on the REST host. A failed or empty reply there points at the link-metadata module, not the editor. Signed in, also check that the Settings switch is on.

Done when

Related: #242 (link hovercard).

Activity

  1. added this to the v2.3.0 milestone on Nov 4, 2026
  2. added
    enhancement
    Editor
    on Nov 4, 2026
  3. HMarzban commented on Nov 4, 2026

    @HMarzban
    CollaboratorAuthor

    Status, 2026-11-04. The earlier "not pushed yet" note is out of date. The work is on main in 4e1aca058, and deploy run 41854096960 shipped it.

    Left:

    • [maintainer] Production check steps 4–6 are not recorded yet: ⌘Z twice, ⌘⇧V keeps the address, and dummy.pdf. The 2026-11-04 check covered steps 2–3.
    • [maintainer] Publish @docs.plus/extension-hyperlink 2.3.0 with pasteTitle (release box on Keep look-alike addresses out of pasted link titles #682).
  4. modified the milestones: v2.3.0, v2.4.0 on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EditorExtensionFeatureenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions