Block links should display the intended block, for non-bulleted "header lines"

We strongly recommend you to search the forum with possible keywords before making a new feature request. If your request is very similar to an existing one, consider liking it and/or making a comment rather than making a new one. Once you’ve searched and determined that this is a new request, delete this line.

Use case or problem

A link to a “block” of the following, common format:

Header: ^block-link
- Item 1
- Item 2…

yields a link (e.g. [[#block-link]]) that, when hovered over (with Ctrl/Cmd pressed) does not display the items but only the header.

The notion of “block” is sufficiently open to allow for this, I understand.

Proposed solution

I would argue that the intent of the format above is clearly that the Header is associated with the items, so that hovering over the block link should display the items too. This would make the hovering feature way more useful.

A subtlety in the definition of a block is that we probably want the following (probably less common, but possible structure) to contain 2 blocks, for instance:

Header 1: ^block-link-1
- Item 1
- Item 2…
Header 2: ^block-link-2
- Item 1
- Item 2…

Current workaround

A workaround would be to force users to itemize everything, like so:

- Header 1: ^block-link
  - Item 1
  - Item 2…

as the link [[#^block-link]] now properly displays the items.

Generalizing this useful behavior to the first example above, where the header doesn’t have a bullet, is a behavior that can logically be expected.

1 Like

I would consider this a bug rather than a feature request. The preview shows only the header which makes the preview essentially useless.

1 Like

This is not a bug as the list belongs to a different markdown block. Your header line is not a heading in the markdown sense.

If you want to include only some bullets or the whole list, there’s a way to do that and it’s explained in the docs.

An alternative is to use a proper markdown heading and use link to heading.

Semantically, if you have a header, you have H1-H6 markup for that.

###### Header
- Item 1
- Item 2

[[#header]] will include that header and all content until another header of the same or higher level.

Another workaround is to wrap what you consider a block into a blockquote:

> Header
> - Item 1
> - Item 2
^block-link

If plain text has special meaning - it is not at all obvious to machine and would require a markup convention…

To make what OP requests (link to a block that might include plain text and lists) would require non-trivial extension of Markdown specification - stronger paragraph definition - everything that is not separated by empty lines is grouped into one HTML block. I can imagine that will also be difficult to work in live preview.

You may be interested in this feature request: Header level support for Linking To/Embedding Ranges

Thanks!

Thanks.
I currently do some CSS tricks when embedding page sections, but it would’ve been great to have powerful syntax for ranges.
I’ve dropped my suggestions to that thread.

1 Like