0

Using CKeditor5 in Drupal site... is there a way to avoid converting a specific URL to link in a specific page or paragraph? How?

Update: explanation

I have a paragraph where I give the bibtex to copy; one of the entries of the bibtex is an url which has to be presented like in this picture: enter image description here

But CKeditor5 presents it this way:

howpublished = {\href{<a href="http://www.chandia.net/corlexim">http://www.chandia.net/corlexim</a>}{<a href="http://www.chandia.net/corlexim">http://www.chandia.net/corlexim</a>}},

Note that in this explanation I have entered the line as it should be presented but it has been automatically converted to links...

4
  • I'm pretty sure there's no easy off-the-shelf way to do this. What's the context? Is this a spam link? An internal link that should not be exposed? Commented Aug 6, 2023 at 4:23
  • I'll put context in the question, thanks for bringing that to mind Commented Aug 6, 2023 at 8:18
  • I cannot reproduce it. On Drupal 10, entering that line in CKEditor5, CKEditor5 shows the source as <p>howpublished = {\href{http://www.chandia.net/corlexim}{http://www.chandia.net/corlexim}}</p>. If I enable Convert URLs into links URLs are shown as links, but CKEditor5 still shows the source as <p>howpublished = {\href{http://www.chandia.net/corlexim}{http://www.chandia.net/corlexim}}</p>.
    – apaderno
    Commented Aug 6, 2023 at 14:50
  • I checked it and you're right, when the text with the url is between <p></p> it remains as it should. My fault, I didn't mention that the text with url is inside <textarea></textarea>, and the one I put in the question above is between <code></code> Commented Aug 6, 2023 at 16:42

2 Answers 2

3

I can reproduce this only when the node is using the Full HTML input format an the Convert URLs into links filter is enabled for that input format. In this case, a node that contains <textarea>howpublished = {\href{http://www.chandia.net/corlexim}{http//www.chandia.net/corlexim}}</textarea> is rendered as the following screenshot shows.

screenshot

The only way to avoid that is disabling the Convert URLs into links filter in /admin/config/content/formats/manage/full_html. When I do that, the node is rendered as expected.

screenshot

2
  • Thanks, you have given me the idea of creating a new text format which have url to link conversion disabled and apply that text format for the page I'm working with... Commented Aug 7, 2023 at 11:33
  • Thanks again @apademo, that did it!!! Commented Aug 7, 2023 at 11:53
0

Thanks to @apademo's answer I came up with the idea (actually it is so logically obvious) of creating a new "text format" in Drupal which does not have activated "Convert URLs into links" option, but it has all of the others (or the ones you need) that make it a "Complete Html" format.

Then, I have applied that format to the page where I don't want the urls converted into links...

Obviously, if there is some other URL in the same page that you do want to convert into link, you will have to do it manually:

<a href="https://www.example.com">Manualy Linked URL</a>

Thanks for the answers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.