Skip to content

fix(links): allow inline code within links#8318

Merged
mejo- merged 1 commit intomainfrom
fix/code_in_link
Mar 17, 2026
Merged

fix(links): allow inline code within links#8318
mejo- merged 1 commit intomainfrom
fix/code_in_link

Conversation

@mejo-
Copy link
Member

@mejo- mejo- commented Mar 8, 2026

The Tiptap inline code mark extension excludes all other mark types from coexisting with itself. This makes sense for most mark types, but link is an exception.

Unfortunately there's no way to dynamically create a list of all marks when excludes is initialized, as this happens when compiling the editor schema, so the latter is not available yet.

Thus to fix the bug while keeping the side effects small, we have to explicitely list all mark types except link and code in excludes in the code mark definition.

Fixes: #4900

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests

@mejo- mejo- self-assigned this Mar 8, 2026
@mejo- mejo- requested a review from max-nextcloud as a code owner March 8, 2026 22:25
@mejo- mejo- added the bug Something isn't working label Mar 8, 2026
@mejo- mejo- requested a review from silverkszlo as a code owner March 8, 2026 22:25
@mejo- mejo- added feature: formatting Features related to text formatting and node types 3. to review format: markdown labels Mar 8, 2026
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this also allows creating links within inline code blocks.

While having code in link titles seems fine, having links in inline code does not seem like a good idea. What would this even be serialized to?

So I suspect in order to make this work as intended we will need another check in setLink and related commands that confirms we're not inside an inline code block.

Not sure what to do about overlapping code and link.

@max-nextcloud
Copy link
Collaborator

grafik

Hum... so the serialization looks okay:

Hello you `inline `[`code`](https://nextcloud.com)` how are what about https://autolink.com ? yoy` ?

@mejo- mejo- force-pushed the fix/code_in_link branch from 73f96b3 to 4073c85 Compare March 17, 2026 13:53
@mejo-
Copy link
Member Author

mejo- commented Mar 17, 2026

/backport to stable33

The Tiptap inline code mark extension excludes all other mark types from
coexisting with itself. This makes sense for most mark types, but link
is an exception.

Unfortunately there's no way to dynamically create a list of all marks
when `excludes` is initialized, as this happens when compiling the
editor schema, so the latter is not available yet.

Thus to fix the bug while keeping the side effects small, we have to
explicitely list all mark types except link and code in `excludes` in
the code mark definition.

Fixes: #4900

Signed-off-by: Jonas <jonas@freesources.org>
@mejo- mejo- force-pushed the fix/code_in_link branch from f553117 to 3a6ea81 Compare March 17, 2026 14:00
@mejo- mejo- merged commit 280d292 into main Mar 17, 2026
64 checks passed
@mejo- mejo- deleted the fix/code_in_link branch March 17, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working feature: formatting Features related to text formatting and node types format: markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Links removed on text formatted as inline code

3 participants