Feature: Support for Pandoc-flavored Markdown header attributes
This one is possibly a bit fiddly, but seems very similar to span links
So some flavors of markdown are able to use header attributes which are very similar to span links, but with an important distinction. Here's a quote from the pandoc documentation.
Headings can be assigned attributes using this syntax at the end of the line containing the heading text:
{#identifier .class .class key=value key=value}
Thus, for example, the following headings will all be assigned the identifier foo:
# My heading {#foo}
## My heading ## {#foo}
My other heading {#foo}
So essentially span links get formatted with square brackets then curly's like so:
[link-text]{#custom-attribute}
While Header attributes look like any various number of header styles with a space following, then the curly's:
# Header {#custom-attribute}
Anyway, thanks for the incredibly fantastic plugin! I'd love if this were implemented because I'm continually using span links to link to headers with custom attributes for a choose-your-own-adventure book I'm working on.
What's the functionality you want specifically? Is it that you want the follow links function to accommodate this style of link?
Yep! A follow link should jump to a header that's marked with a custom attribute.
That'd be cool. This syntax # Header {#custom-attribute} is used by the markdown-it npm packages too.
I believe it works here on github as well!
Related issue https://github.com/jakewvincent/mkdnflow.nvim/issues/89
Oh... wait not quite as related as I thought... that's about autocomplete of the link whereas this is explicitly about following the link; both are about links to headers.
@fullstopslash bracketed spans/span links (like [text]{#id}) are already supported, but I think support for linking to headers with explicitly defined ID attributes (following the pandoc syntax) would be a worthy addition.
@fullstopslash if you're interested in testing it out, I've pushed an implementation of this to the dev branch. Will merge it to main after a bit more testing.
So Not entirely certain what's going on, but the dev branch freezes neovim for me anytime I try to follow a link, or any link really. The work around I've been using until now has been to format my headers as if they're links, and then append the attribute for pandoc to pick up, like so:
[Header]{#custom-attribute} {#custom-attribute}
@fullstopslash sorry about that! Should be fixed now if you pull the latest.
Seems solid from my end!