-
Notifications
You must be signed in to change notification settings - Fork 998
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
Build fails because of the [false] anchor validation error #1707
Comments
See getzola/zola#1707 Signed-off-by: Alexander Borsuk <me@alex.bio>
We are not parsing HTML for anchors in markdown so that's expected. |
Well, that's not cool. Especially if you have a multilingual site, where the same Also, what about links from shortcodes? |
You would refer to the one from the current language? Or do you mean you would have only anchors in say English for all languages?
MD shortcodes links would still be checked, HTML ones no. |
Example:
Any chance to check the whole generated HTML for valid links/ids? It obviously looks wrong: the id is there, but the validator says "no, it's not there". |
It isn't there in the second case though? As you write, it's a link to an anchor named
Very unlikely, that would have to be opt-in and would likely make zola several times slower |
I guess that the slowness would come from a fully correct parse of HTML, but a heuristic parse for |
True. A simple substring search should be enough. Regarding translations: our use case is when users contribute to site translations. And they are not aware that changing h1-h6 headers in Markdown also changes ids. Btw, is there a markdown way to set a fixed id to headers? |
@biodranik Documentation suggests that
should give a manually derived ID which is stable. |
Good, a bit better but not ideal. |
We actually do have code in the link checker to check for anchors: https://github.com/getzola/zola/blob/master/components/link_checker/src/lib.rs#L107-L120 but it's only used for external links so it's not that simple. And that function doesn't check for mixed cases |
I'm having issues with this too (manually added some anchor tags for footnotes on essays), and I'm confused why this wasn't a problem for me until this week. Did the behaviour change? Now I have 36 broken links and can't build my site, even though it built just a few days ago. |
Can you bisect it? Taking the last 0.14 release that worked for you as the start commit. |
I have added a heuristic parser for HTML anchors now in the above PR. I think it is mostly complete in its own terms, just needs squashing and PRing to Would you be interested in this code? |
I happened to run into this yesterday. The content I'm working with has a lot of hand-built ToCs which link to @Keats I ran a bisect and 51784aa came up. The (Here's the test case I used for the bisect) test case: example.md
|
I've upgraded from 0.13 to 0.15.2 and was caught by surprise by this. I sometimes write links as Can't do that anymore :) |
@Keats just in case it wasn't clear, there aren't any new tests in my commit; I just copied the pre-existing tests along with the function when I moved it into utils. |
Oh, so that's what's causing this issue. It's preventing me from building my site, as I have a post with a ton of citations at the bottom: [<sup>\[1\]</sup>](#1)
...
<a id="1">[1]</a> Ha, Anthony. "With Brave Software, JavaScript’s Creator Is Building A Browser For The Ad-Blocked Future." TechCrunch, 20 Jan. 2016, techcrunch.com/2016/01/20/with-brave-software-javascripts-inventor-is-building-a-browser-for-the-ad-blocked-future. \([archive.org](https://web.archive.org/web/20201129075416/https://techcrunch.com/2016/01/20/with-brave-software-javascripts-inventor-is-building-a-browser-for-the-ad-blocked-future/)\) |
You can try the |
thanks @Keats :) |
Bug Report
Environment
Zola version: 0.15.2 (mac os x)
Expected Behavior
zola serve
should work.Current Behavior
Step to reproduce
The markdown source contains a link in the form
[Install here](#install)
.Neither
<p id="install">
nor<a name="install">
in the same markdown file are detected by Zola. It only works with markdown sections started from 2 or more#
characters.The text was updated successfully, but these errors were encountered: