Skip to content

Commit e488eba

Browse files
authored
Enable descriptive-link-text markdown lint rule (#39495)
* Enable descriptive-link-text markdown lint rule * Address reviews
1 parent 05592fd commit e488eba

File tree

42 files changed

+128
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+128
-109
lines changed

.markdownlint.jsonc

+18-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,24 @@
170170
},
171171
// Disabled, as yari generates link fragments by replacing spaces with underscores, not dashes.
172172
"link-fragments": false,
173-
// TODO: enable
174-
"descriptive-link-text": false,
173+
"descriptive-link-text": {
174+
"prohibited_texts": [
175+
"here",
176+
"link",
177+
"more",
178+
"this",
179+
"this link",
180+
"this page",
181+
"this site",
182+
"this article",
183+
"click here",
184+
"click this link",
185+
"see here",
186+
"see this page",
187+
"see this site",
188+
"see this article",
189+
],
190+
},
175191

176192
// https://github.com/OnkarRuikar/markdownlint-rule-search-replace
177193
"search-replace": {

files/en-us/learn_web_development/core/css_layout/fundamental_layout_comprehension/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you have worked through this module then you will have already covered the ba
1212

1313
## Starting point
1414

15-
You can download the HTML, CSS, and a set of six images [here](https://github.com/mdn/learning-area/tree/main/css/css-layout/fundamental-layout-comprehension).
15+
You can download the HTML, CSS, and a set of six images [in our learning-area repo](https://github.com/mdn/learning-area/tree/main/css/css-layout/fundamental-layout-comprehension).
1616

1717
Save the HTML document and stylesheet into a directory on your computer, and add the images into a folder named `images`. Opening the `index.html` file in a browser should give you a page with basic styling but no layout, which should look something like the image below.
1818

files/en-us/learn_web_development/core/scripting/debugging_javascript/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ There are a number of common JavaScript problems that you will want to be mindfu
5050

5151
- Basic syntax and logic problems (again, check out [Troubleshooting JavaScript](/en-US/docs/Learn_web_development/Core/Scripting/What_went_wrong)).
5252
- Making sure variables, etc. are defined in the correct scope, and you are not running into conflicts between items declared in different places (see [Function scope and conflicts](/en-US/docs/Learn_web_development/Core/Scripting/Functions#function_scope_and_conflicts)).
53-
- Confusion about [this](/en-US/docs/Web/JavaScript/Reference/Operators/this), in terms of what scope it applies to, and therefore if its value is what you intended. You can read [What is "this"?](/en-US/docs/Learn_web_development/Core/Scripting/Object_basics#what_is_this) for a light introduction; you should also study examples like [this one](https://github.com/mdn/learning-area/blob/7ed039d17e820c93cafaff541aa65d874dde8323/javascript/oojs/assessment/main.js#L143), which shows a typical pattern of saving a `this` scope to a separate variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct `this` scope.
53+
- Confusion about [`this`](/en-US/docs/Web/JavaScript/Reference/Operators/this), in terms of what scope it applies to, and therefore if its value is what you intended. You can read [What is "this"?](/en-US/docs/Learn_web_development/Core/Scripting/Object_basics#what_is_this) for a light introduction; you should also study examples like [this one](https://github.com/mdn/learning-area/blob/7ed039d17e820c93cafaff541aa65d874dde8323/javascript/oojs/assessment/main.js#L143), which shows a typical pattern of saving a `this` scope to a separate variable, then using that variable in nested functions so you can be sure you are applying functionality to the correct `this` scope.
5454
- Incorrectly using functions inside loops that iterate with a global variable (more generally "getting the scope wrong").
5555

5656
> [!CALLOUT]

files/en-us/learn_web_development/core/scripting/functions/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Bear in mind that some built-in browser functions are not part of the core JavaS
8787

8888
**Functions** that are part of objects are called **methods**; you'll learn about objects later in the module. For now, we just wanted to clear up any possible confusion about method versus function — you are likely to meet both terms as you look at the available related resources across the Web.
8989

90-
The built-in code we've made use of so far comes in both forms: **functions** and **methods.** You can check the full list of the built-in functions, as well as the built-in objects and their corresponding methods [here](/en-US/docs/Web/JavaScript/Reference/Global_Objects).
90+
The built-in code we've made use of so far comes in both forms: **functions** and **methods.** You can check the full list of the built-in functions, as well as the built-in objects and their corresponding methods [in our JavaScript reference](/en-US/docs/Web/JavaScript/Reference/Global_Objects).
9191

9292
You've also seen a lot of **custom functions** in the course so far — functions defined in your code, not inside the browser. Anytime you saw a custom name with parentheses straight after it, you were using a custom function. In our [random-canvas-circles.html](https://mdn.github.io/learning-area/javascript/building-blocks/loops/random-canvas-circles.html) example (see also the full [source code](https://github.com/mdn/learning-area/blob/main/javascript/building-blocks/loops/random-canvas-circles.html)) from our [loops article](/en-US/docs/Learn_web_development/Core/Scripting/Loops), we included a custom `draw()` function that looked like this:
9393

files/en-us/learn_web_development/core/structuring_content/creating_links/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ Let's look at a specific example:
251251
<p><a href="https://www.mozilla.org/en-US/firefox/new/">Download Firefox</a></p>
252252
```
253253

254+
<!-- markdownlint-disable descriptive-link-text -->
255+
254256
**Bad** link text: [Click here](https://www.mozilla.org/en-US/firefox/new/) to download Firefox
255257

256258
```html example-bad
@@ -260,6 +262,8 @@ Let's look at a specific example:
260262
</p>
261263
```
262264

265+
<!-- markdownlint-enable descriptive-link-text -->
266+
263267
Other tips:
264268

265269
- Don't repeat the URL as part of the link text — URLs look ugly, and sound even uglier when a screen reader reads them out letter by letter.

files/en-us/learn_web_development/core/styling_basics/box_model/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Can you change the size of the second box (by adding CSS to the `.alternate` cla
290290
{{EmbedLiveSample("box-models", "", "400px")}}
291291

292292
> [!NOTE]
293-
> You can find a solution for this task [here](https://github.com/mdn/css-examples/blob/main/learn/solutions.md#the-box-model).
293+
> You can find a solution for this task [in our css-examples repo](https://github.com/mdn/css-examples/blob/main/learn/solutions.md#the-box-model).
294294
295295
### Use browser DevTools to view the box model
296296

files/en-us/learn_web_development/extensions/performance/multimedia/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Finally, should you want to include animated images on your page, then know that
103103

104104
#### Serving the optimal size
105105

106-
In image delivery the "one size fits all" approach will not yield the best results, meaning that for smaller screens you would want to serve images with smaller resolution and vice versa for larger screens. On top of that, you'd also want to serve higher resolution images to those devices that boast a high DPI screen (e.g., "Retina"). So apart from creating plenty of intermediate image variants you also need a way to serve the right file to the right browser. That's where you would need to upgrade your `<picture>` and `<source>` elements with [media](/en-US/docs/Web/HTML/Reference/Elements/source#media) and/or [sizes](/en-US/docs/Web/HTML/Reference/Elements/source#sizes) attributes. A detailed article on how to combine all of these attributes can be found [here](https://www.smashingmagazine.com/2014/05/responsive-images-done-right-guide-picture-srcset/).
106+
In image delivery the "one size fits all" approach will not yield the best results, meaning that for smaller screens you would want to serve images with smaller resolution and vice versa for larger screens. On top of that, you'd also want to serve higher resolution images to those devices that boast a high DPI screen (e.g., "Retina"). So apart from creating plenty of intermediate image variants you also need a way to serve the right file to the right browser. That's where you would need to upgrade your `<picture>` and `<source>` elements with [`media`](/en-US/docs/Web/HTML/Reference/Elements/source#media) and/or [`sizes`](/en-US/docs/Web/HTML/Reference/Elements/source#sizes) attributes. [Responsive images done right: A guide to `<picture>` and `srcset`](https://www.smashingmagazine.com/2014/05/responsive-images-done-right-guide-picture-srcset/) explains in detail how to combine all of these attributes.
107107

108108
Two interesting effects to keep in mind regarding high dpi screens is that:
109109

files/en-us/learn_web_development/extensions/server-side/django/development_environment/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ The libraries we'll use for creating our virtual environments are [virtualenvwra
224224

225225
#### Ubuntu virtual environment setup
226226

227-
After installing Python and pip you can install _virtualenvwrapper_ (which includes _virtualenv_). The official installation guide can be found [here](https://virtualenvwrapper.readthedocs.io/en/latest/install.html), or follow the instructions below.
227+
After installing Python and pip you can install _virtualenvwrapper_ (which includes _virtualenv_). You can check [the official installation guide](https://virtualenvwrapper.readthedocs.io/en/latest/install.html), or follow the instructions below.
228228

229229
Install the tool using _pip3_:
230230

@@ -463,7 +463,7 @@ Now that the repository ("repo") is created on GitHub we are going to want to cl
463463
In the "Clone" section, select the "HTTPS" tab, and copy the URL.
464464
If you used the repository name "django_local_library", the URL should be something like: `https://github.com/<your_git_user_id>/django_local_library.git`.
465465
466-
2. Install _git_ for your local computer (you can find versions for different platforms [here](https://git-scm.com/downloads)).
466+
2. Install _git_ for your local computer ([official Git download guide](https://git-scm.com/downloads)).
467467
3. Open a command prompt/terminal and clone your repo using the URL you copied above:
468468
469469
```bash

files/en-us/learn_web_development/extensions/server-side/django/models/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ Some things to consider:
490490
- Should "language" be associated with a `Book`, `BookInstance`, or some other object?
491491
- Should the different languages be represented using model, a free text field, or a hard-coded selection list?
492492
493-
After you've decided, add the field. You can see what we decided on GitHub [here](https://github.com/mdn/django-locallibrary-tutorial/blob/main/catalog/models.py).
493+
After you've decided, add the field. You can see what we decided [for our project on GitHub](https://github.com/mdn/django-locallibrary-tutorial/blob/main/catalog/models.py).
494494
495495
Don't forget that after a change to your model, you should again re-run your database migrations to add the changes.
496496

files/en-us/learn_web_development/extensions/server-side/express_nodejs/deployment/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ The steps are:
378378

379379
Now that the repository ("repo") is created on GitHub we are going to want to clone (copy) it to our local computer:
380380

381-
1. Install _git_ for your local computer (you can find versions for different platforms [here](https://git-scm.com/downloads)).
381+
1. Install _git_ for your local computer ([official Git download guide](https://git-scm.com/downloads)).
382382
2. Open a command prompt/terminal and clone your repo using the URL you copied above:
383383

384384
```bash

files/en-us/learn_web_development/howto/tools_and_setup/how_much_does_it_cost/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Because FTP is inherently insecure, you should make sure to use SFTP — the sec
7777

7878
## Browsers
7979

80-
You either already have a browser or can get one for free. If necessary, download Firefox [here](https://www.mozilla.org/en-US/firefox/all/) or Google Chrome [here](https://www.google.com/chrome/).
80+
You either already have a browser or can get one for free. If necessary, download [Firefox](https://www.mozilla.org/en-US/firefox/all/) or [Google Chrome](https://www.google.com/chrome/).
8181

8282
## Web access
8383

files/en-us/learn_web_development/howto/web_mechanics/what_is_a_domain_name/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ Okay, we talked a lot about processes and architecture. Time to move on.
171171
- If you want to get hands-on, it's a good time to start digging into design and explore [the anatomy of a web page](/en-US/docs/Learn_web_development/Howto/Design_and_accessibility/Common_web_layouts).
172172
- It's also worth noting that some aspects of building a website cost money. Please refer to [how much it costs to build a website](/en-US/docs/Learn_web_development/Howto/Tools_and_setup/How_much_does_it_cost).
173173
- Or read more about [Domain Names](https://en.wikipedia.org/wiki/Domain_name) on Wikipedia.
174-
- You can also find [here](https://howdns.works/) a fun and colorful explanation of how DNS works.
174+
- The [How DNS works](https://howdns.works/) tutorial has a fun and colorful explanation.

files/en-us/mdn/writing_guidelines/howto/document_an_http_header/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This article explains how to create a new reference page for an HTTP header.
1818

1919
## Step 2 – Check the existing HTTP header pages
2020

21-
- Existing HTTP headers are documented [here](/en-US/docs/Web/HTTP/Reference/Headers).
21+
- Existing HTTP headers are documented [in the HTTP reference](/en-US/docs/Web/HTTP/Reference/Headers).
2222
- There are different header categories: {{Glossary("Request header")}}, {{Glossary("Response header")}}, and {{Glossary("Representation header")}}.
2323
- Find the category of the header you are about to document (note that some headers can be both request and response headers, depending on the context).
2424
- Go to an existing header reference page that has the same category.

files/en-us/mdn/writing_guidelines/howto/json_structured_data/index.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ There are two other keys, `"dictionaries"` and `"callbacks"`, operating on the s
8383
8484
### Update process for GroupData
8585

86-
This file should be updated in the same PR where changes affecting the sidebar happens. That way, the sidebar is always up-to-date. Reviewers shouldn't merge PRs that don't adopt it.
86+
This file, located at [`files/jsondata/GroupData.json`](https://github.com/mdn/content/blob/main/files/jsondata/GroupData.json), should be updated in the same PR where changes affecting the sidebar happens. That way, the sidebar is always up-to-date. Reviewers shouldn't merge PRs that don't adopt it.
8787

8888
To test your changes, check that the sidebar in the files in your PR displays all entries correctly.
8989

90-
The `GroupData.json` file is located [here](https://github.com/mdn/content/blob/main/files/jsondata/GroupData.json) on GitHub.
91-
9290
## InterfaceData: recording interface inheritance
9391

9492
> [!NOTE]
@@ -116,12 +114,10 @@ The value of `"Name_of_the_parent_interface"` is not a list but a single entry,
116114

117115
### Update process for InterfaceData
118116

119-
The same PR adding a new interface that inherits from another one must update this file. Reviewers shouldn't merge PRs that don't do so.
117+
The same PR adding a new interface that inherits from another one must update this file, located at [`files/jsondata/InterfaceData.json`](https://github.com/mdn/content/blob/main/files/jsondata/InterfaceData.json). Reviewers shouldn't merge PRs that don't do so.
120118

121119
To test your changes, check that the sidebars of each interface you edited in your PR display inheritance correctly.
122120

123-
The `InterfaceData.json` file is located [here](https://github.com/mdn/content/blob/main/files/jsondata/InterfaceData.json) on GitHub.
124-
125121
## SpecData: Specification information
126122

127123
> [!WARNING]

files/en-us/mdn/writing_guidelines/writing_style_guide/index.md

+4
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,14 @@ For example:
144144

145145
Additionally, avoid using vague link text like "Click here" or "Read this article". Descriptive link text provides better context for all readers and improves the experience for users of assistive technologies.
146146

147+
<!-- markdownlint-disable descriptive-link-text -->
148+
147149
- **Correct**: "Learn more about [how to order flex items](/en-US/docs/Web/CSS/CSS_flexible_box_layout/Ordering_flex_items)."
148150
- **Incorrect**: "Click [here](/en-US/docs/Web/CSS/CSS_flexible_box_layout/Ordering_flex_items) to learn more."
149151
- **Incorrect**: "Read [this article](/en-US/docs/Web/CSS/CSS_flexible_box_layout/Ordering_flex_items) to learn more."
150152

153+
<!-- markdownlint-enable descriptive-link-text -->
154+
151155
By following these guidelines, you help make MDN documentation accessible, clear, and usable by everyone, regardless of how they access the page.
152156

153157
### Write with SEO in mind

files/en-us/mozilla/add-ons/webextensions/api/runtime/getbackgroundpage/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This is an asynchronous function that returns a {{JSxRef("Promise")}}.
2222
> [!NOTE]
2323
> In Firefox, this method cannot be used in Private Browsing mode — it always returns `null`. For more info see [Firefox bug 1329304](https://bugzil.la/1329304).
2424
>
25-
> In Chrome, this method is available only with persistent background pages, which are not available in Manifest V3, so consider using Manifest V2. See the [this](https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers) for details.
25+
> In Chrome, this method is available only with persistent background pages, which are not available in Manifest V3, so consider using Manifest V2. See [Migrate to a service worker](https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers) for details.
2626
>
2727
> Consider using {{WebExtAPIRef("runtime.sendMessage","runtime.sendMessage()")}} or {{WebExtAPIRef("runtime.connect","runtime.connect()")}}, which work correctly in both scenarios above.
2828

files/en-us/mozilla/add-ons/webextensions/native_messaging/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ If you haven't managed to run the application, you should see an error message g
396396

397397
- Check that the name passed to `runtime.connectNative()` matches the name in the app manifest
398398
- macOS/Linux: check that name of the app manifest is `<name>.json`.
399-
- macOS/Linux: check the native application's manifest file location as mentioned [here](/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#macos).
399+
- macOS/Linux: check the native application's manifest file location as mentioned [in the native manifests reference](/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#macos).
400400
- Windows: check that the registry key is in the correct place, and that its name matches the name in the app manifest.
401401
- Windows: check that the path given in the registry key points to the app manifest.
402402

files/en-us/mozilla/firefox/releases/17/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Firefox 17 shipped on November 20, 2012. This article lists key changes that are
3636
### JavaScript
3737

3838
- [`String`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) object now offers Harmony [`startsWith`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith), [`endsWith`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith), and [`contains`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) methods ([Firefox bug 772733](https://bugzil.la/772733)).
39-
- The String methods [link](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/link) and [anchor](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/anchor) now escape the `'"'` (quotation mark) ([Firefox bug 352437](https://bugzil.la/352437)).
39+
- The String methods [`link()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/link) and [`anchor()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/anchor) now escape the `'"'` (quotation mark) ([Firefox bug 352437](https://bugzil.la/352437)).
4040
- Experimental support for strawman `ParallelArray` object has been implemented ([Firefox bug 778559](https://bugzil.la/778559)).
4141
- Support to iterate [`Map`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)/[`Set`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) ([Firefox bug 725909](https://bugzil.la/725909)).
4242
- Disabled ECMAScript for XML (E4X), an abandoned JavaScript extension, for web content by default ([Firefox bug 778851](https://bugzil.la/778851)).

files/en-us/mozilla/firefox/releases/22/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ page-type: firefox-release-notes
5454

5555
- The `properties` parameter has been removed from the `nsITreeView.getCellProperties()`, `nsITreeView.getColumnProperties()` and `nsITreeView.getRowProperties()` methods of `nsITreeView`. These methods should now return a string of space-separated property names ([Firefox bug 407956](https://bugzil.la/407956)).
5656
- The `inIDOMUtils.getCSSPropertyNames()` method has been implemented and will return all supported [CSS property](/en-US/docs/Web/CSS/Reference) names.
57-
- See [here](https://blog.mozilla.org/addons/2013/06/03/compatibility-for-firefox-22/) for more changes.
57+
- See [the Mozilla blog](https://blog.mozilla.org/addons/2013/06/03/compatibility-for-firefox-22/) for more changes.
5858

5959
### Firefox Developer Tools
6060

0 commit comments

Comments
 (0)