Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive "invalid_ref" for IDs on links #74

Open
MasonRemaley opened this issue Oct 14, 2024 · 2 comments
Open

False positive "invalid_ref" for IDs on links #74

MasonRemaley opened this issue Oct 14, 2024 · 2 comments

Comments

@MasonRemaley
Copy link
Contributor

MasonRemaley commented Oct 14, 2024

I'm trying to implement footnotes. Here's my footnote, this would go inline in a paragraph:

[1]($link.ref("1").attrs("footnote")

Later in the text, I'd have the content for the footnote, as another link:

[^1]($link.url("https://example.com").id("1"))

However, I get an error saying that "1" is an invalid ref. If I change the second snippet to be a heading instead of a link, then it works as expected.

[EDIT] Maybe ref thinks that only sections can be linked to? I can see why that would be reasonable in most cases, but in the case of footnotes this is a bit annoying because I don't want all my footnotes to show up in the table of contents.

@kristoff-it
Copy link
Owner

kristoff-it commented Oct 25, 2024

Linking to ids defined in the same content page is a corner case (totally legitimate one, but still) that is not implemented yet. We had some false negatives before when linking to non-section Ids from superhtml, but this one is a separate thing.

Now that v0.7.2 is out, this is currently at the top of my list of missing features to implement.

@kristoff-it
Copy link
Owner

Nvm I've actually now looked into it and I already had implemented this, I just forgot about it lol.

I tried to reproduce the bug but failed: the ref gets recognized successfully and everything is linked successfully.

Make sure you're using the latest release of Zine and then please commit a full repro in a branch for me to take a look at. What's almost certainly happening is that the footnote is placed in a location of the markdown AST where I forgot to properly record seen IDs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants