Skip to content

Conversation

@nilslindemann
Copy link
Contributor

@nilslindemann nilslindemann commented Oct 23, 2023

(I will recreate this in a later PR)

The PR only touches local links to markdowns (links to .pngs and .pys are all good) and does not touch external links.

Aside of fixing broken local links,

  • it makes absolute links relative (no links anymore which start with /)
  • it appends index.md where missing, so that all links either are hash-only in-document links or links with .md in them
  • it removes ./ from start of links

The following patterns can be used to search for these links (and should find nothing with this PR applied):

  • Links without index.md: the regex \]\((?!http)[^)#]*/(#[^#)]+)?\)
  • Absolute links: ](/
  • Links with "./" at the start: ](./

I also fix untranslated #hash-parts in links, so far in es, fr, em. Will add more commits. When the author has not translated the link text, I leave it, instead of guessing.

This script tests if all links are according to the above definitions, and it checks if the path parts of links point to existing files. It does not check if the hash points to an existing heading. After this PR is applied, the script outputs:

> python linkchecker.py 

Each link under /home/nils/FastAPI/fastapi/docs is:

* a https link to an external url
* a well-formed local relative link to a .md / .png / .py

These files are referenced in links but do not exist:
    /home/nils/FastAPI/fastapi/docs/en/docs/advanced/async-sql-databases.md

@tiangolo
Copy link
Member

📝 Docs preview for commit a70447f at: https://1ef63924.fastapitiangolo.pages.dev

nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Oct 23, 2023
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Oct 23, 2023
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Oct 24, 2023
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Oct 24, 2023
@tiangolo
Copy link
Member

📝 Docs preview for commit ee6dacd at: https://1f18c5a9.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit cffefaf at: https://8c342b91.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit 1b6655d at: https://b449584e.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit a2fa82f at: https://ee9a510f.fastapitiangolo.pages.dev

@nilslindemann nilslindemann changed the title Cleanup links 📝 Cleanup local links in docs Oct 31, 2023
@tiangolo
Copy link
Member

📝 Docs preview for commit 325f74d at: https://504d978d.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit 7e5b836 at: https://bff0d3dc.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit 144f351 at: https://1d0fc264.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit 519fbbc at: https://c71024c4.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit 1f67fa4 at: https://934240ea.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

📝 Docs preview for commit ced796f at: https://d1d6f727.fastapitiangolo.pages.dev

nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Nov 1, 2023
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Nov 2, 2023
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Nov 2, 2023
nilslindemann pushed a commit to nilslindemann/fastapi that referenced this pull request Nov 3, 2023
@tiangolo
Copy link
Member

📝 Docs preview for commit 9334014 at: https://acfe7c55.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

tiangolo commented Dec 1, 2023

📝 Docs preview for commit e1bd7e6 at: https://77e01fba.fastapitiangolo.pages.dev

@nilslindemann nilslindemann deleted the cleanup-links branch January 13, 2024 18:11
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

Successfully merging this pull request may close these issues.

2 participants