# prosemirror-markdown 1.14.0: emphasis around a link with edge whitespace serializes to invalid Markdown

**URL:** <https://discuss.prosemirror.net/t/prosemirror-markdown-1-14-0-emphasis-around-a-link-with-edge-whitespace-serializes-to-invalid-markdown/9180>\
**Category:** Uncategorized\
**Created:** [December 2, 2026, 8:07am UTC](https://discuss.prosemirror.net/t/prosemirror-markdown-1-14-0-emphasis-around-a-link-with-edge-whitespace-serializes-to-invalid-markdown/9180 "2026-12-02T08:07:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![345678](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/345678/32/4856_2.png) [@345678](https://discuss.prosemirror.net/u/345678)\
**Post date:** [December 2, 2026, 8:07am UTC](https://discuss.prosemirror.net/t/prosemirror-markdown-1-14-0-emphasis-around-a-link-with-edge-whitespace-serializes-to-invalid-markdown/9180/1 "2026-12-02T08:07:24Z")

</div>

```js
import {schema, defaultMarkdownSerializer} from 'prosemirror-markdown'
const link = schema.marks.link.create({href: 'u'}), strong = schema.marks.strong.create()
const doc = schema.node('doc', null, [schema.node('paragraph', null, [
  schema.text('see '), schema.text('word ', [link, strong]), schema.text('next')])])
console.log(defaultMarkdownSerializer.serialize(doc))

```

1.13.9: `see **[word](u)** next`

1.14.0: `see **[word](u)**next`

The closing `**` is preceded by `)` and followed by `n`, so it isn’t right-flanking, and markdown-it renders `see**<a href="u">word </a>**next`. Leading whitespace (`'see', ' word'`) and `em` behave the same way. It started with [13f197ac](https://code.haverbeke.berlin/prosemirror/prosemirror-markdown/commit/13f197ac29ea5ebe2bf241eca8fe601cfe26dea1).

P.S. I tried to file this on the issue tracker, but logging in there with GitHub ended in a 500 error.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [December 2, 2026, 11:41am UTC](https://discuss.prosemirror.net/t/prosemirror-markdown-1-14-0-emphasis-around-a-link-with-edge-whitespace-serializes-to-invalid-markdown/9180/2 "2026-12-02T11:41:52Z")

</div>

Thanks for the report. I’ve overhauled the way whitespace expelling works, because the old approach couldn’t handle things like this very well without becoming even more obscure and complex.

> **[Do whitespace expelling on the textual level, rather than during inline output...](https://code.haverbeke.berlin/prosemirror/prosemirror-markdown/commit/b40ad01c4484884b8970be187f6eca1826647a9d)**
>
> FIX: Make expelling whitespace from emphasis marks more robust, and insert space that wasn't
> there when necessary to make the output parseable.
> 
> See...

> [@345678](#):
>
> P.S. I tried to file this on the issue tracker, but logging in there with GitHub ended in a 500 error.

Weird. When I try a GitHub login it works, but I suspect in some cases the Anubis bot-blocker might interfere.

---

<div class="post-metadata">

**Author:** ![345678](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/345678/32/4856_2.png) [@345678](https://discuss.prosemirror.net/u/345678)\
**Post date:** [December 2, 2026, 2:35pm UTC](https://discuss.prosemirror.net/t/prosemirror-markdown-1-14-0-emphasis-around-a-link-with-edge-whitespace-serializes-to-invalid-markdown/9180/3 "2026-12-02T14:35:45Z")

</div>

Thanks for the fix!
