zola: Build fails because of the [false] anchor validation error

Bug Report

Environment

Zola version: 0.15.2 (mac os x)

Expected Behavior

zola serve should work.

Current Behavior

Error: The anchor in the link `@/_index.md#install` in organicmaps.github.io/content/_index.md does not exist.

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.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 20 (11 by maintainers)

Commits related to this issue

Most upvoted comments

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 next.

Would you be interested in this code?

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.

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? The vast majority of people use anchors to refer to headers so it hasn’t really been a problem so far.

Example:

This is index.md, it generates `<h1 id="#welcome">Welcome</h1>`

## Welcome

[Link to the Welcome section](#welcome)
This is index.fr.md, it generates `<h1 id="#bienvenue">Bienvenue</h1>`

## Bienvenue

[This link to the Welcome section should be also modified and can not use #welcome](#Bienvenue)

MD shortcodes links would still be checked, HTML ones no.

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”.