Make internal Markdown links not break in Hugo

Use case or problem

I use obsidian with hugo to create a website. My markdown may contain various mistakes which may break the hugo build, or will pass the hugo build but will result in a broken published website. As it stands, obsidian will happily accept those mistakes, or cleverly work around them, as if by magic, and will not give me the slightest hint that I have made mistakes that I am going pay for later. When I later discover the mistakes, obsidian makes it unnecessarily hard for me to find the causes and fix them, because it behaves as if everything is all right.

This is very counter-productive.

I would prefer obsidian to be treating mistakes with error messages, error indications, error reports, alarm bells, sirens, anything as long as it makes it perfectly clear that it detected a mistake.

I know this is a very hard concept for scripting language programmers to grasp, but please believe me when I say that the concept of “error” was invented in computing for very good reasons, and that Postel’s law was never a good idea to begin with.

This feature request pertains to broken internal links. When an internal link pointing either to a note or to a media file is broken, I need obsidian to indicate the error instead of pretending that it is fine and making it work by magic.

Proposed solution

When an internal markdown link is broken, show some error squiggle under it, or around it, or anywhere else in the entire obsidian UI, instead of pretending it is fine. When the link points to an image, show a broken image icon instead of finding the image by magic and showing it to me.

This way, I can take notice of my mistakes, and fix them.

Better yet, since Obsidian is so clever as to be able to divine what the correct link is, have it show me the correct link and suggest to me to replace the broken link with the correct link for me, in the markdown document.

Wiki-style links can continue working as before, for the benefit of users who can’t be bothered with error messages.

Current workaround (optional)

My workaround so far has been to edit my render-link.html in my hugo files and add special code in there that detects local links, and then detects broken local links, and then issues warnings, but this only happens during hugo build, it is inelegant, clunky, and highly niche.

Related feature requests (optional)

There is a related bug report, about Obsidian showing me an image even though I have just deleted that image: Image is still being shown despite being deleted This feature request is about Obsidian showing me an image, or a post, which does exist, but the link does not correctly point to it.

I wonder if it’s happening because Hugo expects a full path whereas Obsidian doesn’t. If that’s what’s causing the broken links in Hugo, then Obsidian’s Settings > Files and links > New link format > Absolute path in vault might avoid the problem for links you create from now on. (Or try the relative setting if Hugo uses relative paths.)

It wouldn’t automatically change links you’ve already created though.

This was discussed at some length in the author’s bug report Links break when moving/renaming linked files. I’m not sure why that wasn’t included as a related link instead of the image one.

I changed the title to more closely reflect the request (tho it could use another revision; original was “Make broken internal links behave like broken”).