Why is it possible to reference a blank header using a period?

I have discovered a fluke (that is helpful, but might not be reliable). Specifically, I can embed a section of another file in a strange circumstance:

  • The section header of interest in the other file is blank. The section header is simply this:
#

This section has an empty header, and this is the content.

(Notice the # with no actual text, indicating a blank section header.)

Now, you’d think that it would either be impossible to embed a link to this (blank) header in another (parent) Markdown file, OR that choosing the section to embed would itself just involve a blank (empty string), as in: ![[file name#]] (notice the # to reference a heading, but an empty string follows).

Not particularly surprisingly, the above method of referencing the child file/section fails.

But I discovered something that works. By using a period in the parent reference, as in ![[file name#.]] (notice the period .), the blank heading IS successfully referenced. Just that block of the child file is properly embedded in the parent file.

Note that I need a blank heading because in Obsidian’s Excalidraw plugin, the section heading along with the content appears in an embedded frame, and the usual Obsidian CSS tricks (which DO work for normal markdown parent files) do not work with Excalidraw frame embeddings to hide this section heading text. And I do not want the heading text itself to appear in the embedded frame. So I tried to find a way to make the heading blank (starting by typing a period for the section heading and noticing that it worked - but that when saving the child Markdown file the period was automatically removed by the linter yet referencing that section with a period still worked!)

So, my question is: Is this expected behavior? Why is it possible to reference a blank header using a period?

4 Likes

Interesting use case and solution. Looks like it also works with more than one period. Just trying a few other characters in tests, I noticed that it also works with commas, backticks, parentheses, colons, semicolons, ampersands, curly brackets, plus signs, equals signs, asterisks, dollar signs, tildas, exclamation points, @ signs, pipe characters, underscores, carets, backslashes, angle brackets, etc. Spaces could also be used as long as they are used in combination with another one of these symbols.

I’m not sure that I would trust that this will continue to work as it currently does. But it’s definitely a good idea to draw attention to it before putting to much faith in it continuing to work.

Also, I’d be curious to see an example of your unique Excalidraw setup. Thanks for sharing!

Fascinating! You’ll notice that some punctuation is stripped when you link to a heading that contains it — maybe this is related to that somehow. I’d guess it’s not intended.

Interesting. I guess this is just a quirk.

Wouldn’t it be cool if there was some syntax so you can embed FROM and TO a certain header. That could be pretty interesting.

Something like:
![[Fancy Note#Chapter 1.#Chapter 3]]
![[Fancy Note#Chapter 1,#Chapter 3]]
![[Fancy Note#Chapter 1>#Chapter 3]]

![[Fancy Note#Chapter 1>]] And with no 2nd element, it would just embed the rest of the file from that point.

1 Like

As often, there’s a plugin for that :wink: : Link Range
(Never used it though :innocent: )

3 Likes

Agreed! Nice syntax!

Also: Header level support for Linking To/Embedding Ranges

Thanks.

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