Skip to content

Fix regular expressions for determining if links are internal

Sarah German requested to merge md-to-html-regex into main

What does this MR do and why?

We use a regular expression to determine if we need to rewrite a link to a .md file as .html in this Nanoc filter, and also in our compile Rules.

Unfortunately these checks can match false positives on internal pages that start with the string http, such as http_routing_service.md (see gitlab!152956 (merged)).

The result of this is that our link tests fail because these links do not get rewritten, and the rendered links point to /ee/architecture/blueprints/cells/http_routing_service.md, which indeed does not exist.

This MR adjusts the regular expressions to consider a link external if it starts with http:// or https:// rather than just http. This should more accurately match external URLs.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md.
  2. Update docs content source projects: make update-all-docs-projects
  3. In your ../gitlab directory, check out this branch: origin/move-http-routing-service
  4. Wipe any old builds and compile the site: make clean && make compile
  5. Run the link test in gitlab-docs: parallel time bundle exec nanoc check ::: internal_links

The link check should no longer flag pages that reference http_routing_service.md.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports