Ignore or prevent linking in code blocks

A dialog box keeps popping up when I’m typing in this code block. The dialog box bafflingly says “No match found” and below that has 3 sections saying “Type # to link heading”, “Type ^ to link blocks” and “Type | to change display text”.

Steps to reproduce

I was working on this bit of example code when I stumbled across it. Paste it into an empty note in the sandbox vault to reproduce reliably.

(def data [[1,2], [3,4]])
(let [[[a b]] data] (println b)) ; 2

(def greeting "Hello, world!")
(let [[ _ _ _ _ _ _ _ name ] greeting] (println (apply str name)))

Moving the cursor after name and adding a space will make the dialog pop up.

(Incidentally, the above code doesn’t work, inserting a & before name captures the tail. But this was the state of the code when the dialog box started bugging me.)

Expected result

I would keep typing without a dialog box getting in my way.

Actual result

Dialog pops up if I type or even delete anything in that section of the code. It make it difficult to edit and copy/paste when I’m experimenting with the code examples.

Environment

  • Operating system: Linux
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v1.1.9
    Installer version: v1.1.9
    Operating system: #1 SMP PREEMPT_DYNAMIC Thu Jan 12 20:29:03 UTC 2023 6.1.5-229.current
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Restricted mode: on

RECOMMENDATIONS:
none


Additional information

I assume what’s happening is all the weird surrounding syntax and square brackets is confusing the Obsidian’s helper for markdown link creation. I would probably disable this helper inside of code blocks to avoid this situation. It will come up a lot with certain languages, to say nothing of code blocks containing actual markdown.

Screenshot from 2023-01-30 01-04-17

Simpler example code.

Paste it into an empty note in the sandbox vault to reproduce reliably.

[[ anything ]]

Pretty much anything between two square brackets will cause the issue. Adding characters. Spaces. Deleting things.

It had been going on for a while and I barely noticed but when it started popping over other parts of my code it became a nuisance.

This is a bigger problem than just wikilinks.
Either this Make Obsidian's behavior on codeblocks dependant on their type or since now we have callouts, threat all code blocks as code-containing.

1 Like

Interesting, thanks!

Is there a way to disable this feature for all code blocks in the meantime?

Not at the moment, sorry.

It might be possible to build a plugin to support such a toggle.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.