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

tactic docs have unwieldy anchors for multiple tactics #74

Open
alexjbest opened this issue Sep 25, 2020 · 2 comments
Open

tactic docs have unwieldy anchors for multiple tactics #74

alexjbest opened this issue Sep 25, 2020 · 2 comments

Comments

@alexjbest
Copy link
Member

On the tactics page some tactics have multiple names or are very similar left / right and by_contra / by_contradiction for one.
So the links in the sidebar or by clicking on headings have spaces in them
https://leanprover-community.github.io/mathlib_docs/tactics.html#nth_rewrite%20/%20nth_rewrite_lhs%20/%20nth_rewrite_rhs

This causes links like tactic#refl or tactic#left not to work on zulip which is a little sad.

@bryangingechen
Copy link
Collaborator

We could add a new field to the tactic doc entry structure to store a list of anchors, and then make doc-gen add all of those to the HTML.

@bryangingechen
Copy link
Collaborator

In fact, spaces are not even really allowed in id attributes: https://validator.w3.org/nu/?doc=https%3A%2F%2Fleanprover-community.github.io%2Fmathlib_docs%2Ftactics.html

(This also affects the attributes, commands, hole_commands and notes pages.)

One simple fix for the spacing issue is to have doc-gen replace spaces with dashes, as it currently does for Markdown headings:

# generate anchor following what github does
# See info and links at https://gist.github.com/asabaylus/3071099
anchor = inner.strip().lower()
anchor = re.sub(r'[^\w\- ]+', '', anchor).replace(' ', '-')

It's probably still worthwhile to do something to get both tactic#left and tactic#right pointing to the right place though.

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