External links - unable to create on some pages

To reproduce:

  1. Create external link from context menu => correct format appears - () using accent color, can create external link correctly

  2. Paste this text after that:
    SomeType someType = Application.Current.Handler.MauiContext.Services.GetService(); _dbService = Application.Current.Handler.MauiContext.Services.GetService();

  3. Copy external link created in step 1 and paste below text inserted in step 2

external text shows but does not get reformatted as a link

v1.5.12

edit - added version

This is because you have some <tags> in there that don’t get closed, so it’s messing up the parsing.

I suggest you put stuff like that inside a code block, either surrounded by triple backticks, or by indenting the entire block.

And I’m just guessing this is javascript, I don’t know. You can put a language name after the backticks to get some code-formatting too:

```javascript
SomeType someType = Application.Current.Handler.MauiContext.Services.GetService<SomeType>();			_dbService = Application.Current.Handler.MauiContext.Services.GetService<LocalDbService>();
```
2 Likes

Really? So it’s my fault that obs is broken?

I understand that the text block is causing the issue. IMO this can and will happen all the time for many reasons and it won’t always be obvious to the user that there’s a problem. - e.g. automation

If it’s really not possible to handle this gracefully, then maybe there’s a way to warn the user?
Anyway, nice product

I didn’t say it was your fault. And Obsidian isn’t broken. Nor can Obsidian assume your intention. So put it in a code block, and the problem is solved; no snark required.

Fair enough. How about a message that can be found when searching for “external link”? I did not find anything which is why I left the bug report. Wouldn’t have bothered if I saw it was a known problem.

Obsidian is a Markdown editor. You’re allowed to enter html anywhere in your document. So you can make custom styles, or tables or layouts, or even embed web pages. So it won’t disallow you from pasting in some code.

And again, that’s why code blocks exist. So you can tell Obsidian something is meant to be displayed as code, without trying to parse it as code.

“external link” doesn’t capture what’s happening here. An un-closed tag can potentially mess up any subsequent Markdown formatting. Tables, bold, italics, everything.

The message or warning you are hoping for is shown as red text in my screenshot. It’s Obsidian showing that it is trying to parse some code. But it would be a much more complicated problem for Obsidian to know what language it is, and what it should do to resolve the issue.

unparsed code:

code block: