-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: AutoLink produces links inside non-highlighted code-blocks #8028
Description
The AutoLinkPlugin (registerAutoLink underneath) does not take code blocks into account, and inserts AutoLinks in code blocks, even though this is not usually desired. This only happens if a highlighter plugin is not used. Can be easily reproduced in the Lexical playground.
Lexical version:
Steps To Reproduce
- In Lexical playground, turn off code highlighting
2.Add a code block and type a link in the code block
Link to code example: https://playground.lexical.dev/?isCodeHighlighted=false
The current behavior
Links are highlighted in code blocks
The expected behavior
AutoLink should ignore links in code blocks
Impact of fix
My current use case expects code blocks to look like code instead of having interactive links. For example, most links included are not meant to be opened by the user, such as in code examples of API calls.
If the current behaviour is desired in some cases, an option could be added to disable highlighting in certain contexts such as code blocks.