SIGN IN SIGN UP
payloadcms / payload UNCLAIMED

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

0 0 279 TypeScript

fix(richtext-lexical): internal links export as [text](undefined) in markdown transformer (#16302)

## Overview

Payload has two types of links: custom (you type a URL) and internal
(you pick a page). For internal links, Payload never stores a URL, only
a reference to the page (`doc`). Whatever renders the link is
responsible for resolving that reference to a URL at render time.

The HTML converters handled this with an `internalDocToHref` callback.
The markdown transformer didn't, so it produced `[text](undefined)` for
every internal link.

## Key Changes

The transformer is now a `createLinkMarkdownTransformer(args?)` factory
that accepts an optional `internalDocToHref` callback. Pass it to
`LinkFeature` and it gets threaded through to the transformer. Without
it, internal links fall back to `[text]()` instead of
`[text](undefined)`.

`LinkMarkdownTransformer` remains as a static backwards-compatible
export.

## Design Decisions

The callback is synchronous unlike the HTML converter variant, because
`doc.value` is already populated by the time markdown export runs.

---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1213983113414606
P
Patrik committed
3dc6041f4751101f7f8a68f294a0491ff631bf15
Parent: 9de13c2
Committed by GitHub <noreply@github.com> on 4/17/2026, 1:30:47 PM