Skip to content

Commit

Permalink
Set code languages for various files (part 1) (#28145)
Browse files Browse the repository at this point in the history
* Set code languages for various files (part 1)

* Revert LaTeX change for now

* Update files/en-us/web/api/performance_api/server_timing/index.md

Co-authored-by: Brian Thomas Smith <[email protected]>

* Update files/en-us/learn/javascript/building_blocks/conditionals/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Update files/en-us/learn/javascript/first_steps/variables/index.md

Co-authored-by: Joshua Chen <[email protected]>

* Fix selected languages

* Fix selected languages

* Fix selected languages

* Apply suggestions from code review

Co-authored-by: Joshua Chen <[email protected]>

---------

Co-authored-by: Brian Thomas Smith <[email protected]>
Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2023
1 parent 9f27a13 commit 8d0cbea
Show file tree
Hide file tree
Showing 96 changed files with 194 additions and 193 deletions.
10 changes: 5 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All prose content is available under

### Text of CC-BY-SA-2.5 license

```
```plain
Creative Commons Attribution-ShareAlike 2.5
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
Expand Down Expand Up @@ -75,13 +75,13 @@ Code examples and snippets added on or after August 20, 2010 are in the public d
([CC0](https://creativecommons.org/publicdomain/zero/1.0/legalcode)). No licensing notice
is necessary, but if you need one, you can use:

```
```plain
Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/
```

#### Text of CC0 license

```
```plain
Creative Commons Legal Code
CC0 1.0 Universal
Expand Down Expand Up @@ -211,13 +211,13 @@ Code examples and snippets added before August 20, 2010 are available under
the [MIT license](https://opensource.org/licenses/MIT). You should insert
the following attribution information into the MIT license template:

```
```plain
© <date of last page revision> <name of person who created it>
```

#### Text of MIT license template

```
```plain
Copyright <YEAR> <COPYRIGHT HOLDER>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/glossary/base64/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ page-type: glossary-definition

When the term "Base64" is used on its own to refer to a specific algorithm, it typically refers to the version of Base64 outlined in [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), section 4, which uses the following alphabet to represent the radix-64 digits, alongside `=` as a padding character:

```
```plain
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
```

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/glossary/etld/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ For example, all the following are eTLD+1 domains:

This means that all domains under each of these domains belong to the same organization. For example:

```
```plain
film.theguardian.com
music.theguardian.com
```

```
```plain
news.sussex.ac.uk
blog.sussex.ac.uk
admissions.sussex.ac.uk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ With {{Glossary("Hypertext")}} and {{Glossary("HTTP")}}, **_URL_** is one of the

Here are some examples of URLs:

```
```plain
https://developer.mozilla.org
https://developer.mozilla.org/en-US/docs/Learn/
https://developer.mozilla.org/en-US/search?q=URL
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/learn/css/first_steps/how_css_works/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Take the following HTML code:

In the DOM, the node corresponding to our `<p>` element is a parent. Its children are a text node and the three nodes corresponding to our `<span>` elements. The `SPAN` nodes are also parents, with text nodes as their children:

```
```plain
P
├─ "Let's use:"
├─ SPAN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ If the image button is used to submit the form, this control doesn't submit its

So for example when you click on the image at coordinate (123, 456) and it submits via the `get` method, you'll see the values appended to the URL as follows:

```
```url
http://foo.com?pos.x=123&pos.y=456
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ HTML (**H**yper**T**ext **M**arkup **L**anguage) is the code that is used to str

HTML is a _markup language_ that defines the structure of your content. HTML consists of a series of **{{Glossary("element", "elements")}}**, which you use to enclose, or wrap, different parts of the content to make it appear a certain way, or act a certain way. The enclosing {{Glossary("tag", "tags")}} can make a word or image hyperlink to somewhere else, can italicize words, can make the font bigger or smaller, and so on. For example, take the following line of content:

```
```plain
My cat is very grumpy
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You are probably reading these words inside a web browser in this very moment (u

Hypertext Transfer Protocol, or [HTTP](/en-US/docs/Web/HTTP/Basics_of_HTTP), is a messaging protocol that allows web browsers to communicate with web servers (where websites are stored). A typical conversation goes something like

```
```plain
"Hello web server. Can you give me the files I need to render bbc.co.uk"?
"Sure thing web browser — here you go"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ There are many other elements in HTML for formatting text, which we didn't get t

In HTML text fundamentals, we walked through how to [mark up basic lists](/en-US/docs/Learn/HTML/Introduction_to_HTML/HTML_text_fundamentals#lists) in HTML, but we didn't mention the third type of list you'll occasionally come across — **description lists**. The purpose of these lists is to mark up a set of items and their associated descriptions, such as terms and definitions, or questions and answers. Let's look at an example of a set of terms and definitions:

```
```plain
soliloquy
In drama, where a character speaks to themselves, representing their inner thoughts or feelings and in the process relaying them to the audience (but not to other characters.)
monologue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ The error messages are usually helpful, but sometimes they are not so helpful; w
- "End of file reached when inside an attribute value. Ignoring tag": This one is rather cryptic; it refers to the fact that there is an attribute value not properly formed somewhere, possibly near the end of the file because the end of the file appears inside the attribute value. The fact that the browser doesn't render the link should give us a good clue as to what element is at fault.
- "End of file seen and there were open elements": This is a bit ambiguous, but basically refers to the fact there are open elements that need to be properly closed. The line numbers point to the last few lines of the file, and this error message comes with a line of code that points out an example of an open element:
```
```plain
example: <a href="https://www.mozilla.org/>link to Mozilla homepage</a> ↩ </ul>↩ </body>↩</html>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ In this article, we cover the absolute basics of HTML. To get you started, this

{{glossary("HTML")}} (HyperText Markup Language) is a _markup language_ that tells web browsers how to structure the web pages you visit. It can be as complicated or as simple as the web developer wants it to be. HTML consists of a series of {{glossary("Element", "elements")}}, which you use to enclose, wrap, or _mark up_ different parts of content to make it appear or act in a certain way. The enclosing {{glossary("Tag", "tags")}} can make content into a hyperlink to connect to another page, italicize words, and so on. For example, consider the following line of text:

```
```plain
My cat is very grumpy
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Now let's turn our attention to lists. Lists are everywhere in life—from your

Unordered lists are used to mark up lists of items for which the order of the items doesn't matter. Let's take a shopping list as an example:

```
```plain
milk
eggs
bread
Expand Down Expand Up @@ -438,7 +438,7 @@ textarea.onkeyup = () => {

Ordered lists are lists in which the order of the items _does_ matter. Let's take a set of directions as an example:

```
```plain
Drive to the end of the road
Turn right
Go straight across the first two roundabouts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ It is better to include such supporting information in the main article text, ra

It is now your turn to play! This active learning section will have you up and running with a simple embedding exercise. You are provided with a basic {{htmlelement("img")}} tag; we'd like you to embed the image located at the following URL:

```
```url
https://raw.githubusercontent.com/mdn/learning-area/master/html/multimedia-and-embedding/images-in-html/dinosaur_small.jpg
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ If you were to add the code below into one of your pages, you might be surprised

If you have a look at your browser's console, you'll see an error message like the following:

```
```plain
Refused to display 'https://developer.mozilla.org/' in a frame because it set 'X-Frame-Options' to 'deny'.
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,21 @@ if (x === 5 || x === 7 || x === 10 || x === 20) {

In such a case, [`switch` statements](/en-US/docs/Web/JavaScript/Reference/Statements/switch) are your friend — they take a single expression/value as an input, and then look through several choices until they find one that matches that value, executing the corresponding code that goes along with it. Here's some more pseudocode, to give you an idea:

```
```js
switch (expression) {
case choice1:
run this code
// run this code
break;

case choice2:
run this code instead
// run this code instead
break;

// include as many cases as you like

default:
actually, just run this code
// actually, just run this code
break;
}
```

Expand Down Expand Up @@ -362,7 +363,7 @@ function setWeather() {

There is one final bit of syntax we want to introduce you to before we get you to play with some examples. The [ternary or conditional operator](/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator) is a small bit of syntax that tests a condition and returns one value/expression if it is `true`, and another if it is `false` — this can be useful in some situations, and can take up a lot less code than an `if...else` block if you have two choices that are chosen between via a `true`/`false` condition. The pseudocode looks like this:

```
```js-nolint
condition ? run this code : run this code instead
```

Expand Down
6 changes: 3 additions & 3 deletions files/en-us/learn/javascript/building_blocks/events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ container.addEventListener("click", handleClick);

You'll see that the parent fires a click event when the user clicks the button:

```
```plain
You clicked on a DIV element
```

Expand Down Expand Up @@ -488,7 +488,7 @@ button.addEventListener("click", handleClick);

You'll see that all three elements fire a click event when the user clicks the button:

```
```plain
You clicked on a BUTTON element
You clicked on a DIV element
You clicked on a BODY element
Expand Down Expand Up @@ -679,7 +679,7 @@ button.addEventListener("click", handleClick);

In this case, the order of messages is reversed: the `<body>` event handler fires first, followed by the `<div>` event handler, followed by the `<button>` event handler:

```
```plain
You clicked on a BODY element
You clicked on a DIV element
You clicked on a BUTTON element
Expand Down
20 changes: 10 additions & 10 deletions files/en-us/learn/javascript/building_blocks/looping_code/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ console.log(upperCats);

Here we pass a function into {{jsxref("Array.prototype.map()","cats.map()")}}, and `map()` calls the function once for each item in the array, passing in the item. It then adds the return value from each function call to a new array, and finally returns the new array. In this case the function we provide converts the item to uppercase, so the resulting array contains all our cats in uppercase:

```
```js-nolint
[ "LEOPARD", "SERVAL", "JAGUAR", "TIGER", "CARACAL", "LION" ]
```

Expand All @@ -207,7 +207,7 @@ console.log(filtered);
This looks a lot like `map()`, except the function we pass in returns a [boolean](/en-US/docs/Learn/JavaScript/First_steps/Variables#booleans): if it returns `true`, then the item is included in the new array.
Our function tests that the item starts with the letter "L", so the result is an array containing only cats whose names start with "L":

```
```js-nolint
[ "Leopard", "Lion" ]
```

Expand Down Expand Up @@ -347,13 +347,13 @@ console.log(myFavoriteCats); // "My cats are called Pete, Biggles, Jasmine, "

The final output sentence isn't very well-formed:

```
```plain
My cats are called Pete, Biggles, Jasmine,
```

We'd prefer it to handle the last cat differently, like this:

```
```plain
My cats are called Pete, Biggles, and Jasmine.
```

Expand Down Expand Up @@ -496,7 +496,7 @@ Here's the output:

First, let's have a look at the [while](/en-US/docs/Web/JavaScript/Reference/Statements/while) loop. This loop's syntax looks like so:

```
```js-nolint
initializer
while (condition) {
// code to run
Expand Down Expand Up @@ -538,7 +538,7 @@ console.log(myFavoriteCats); // "My cats are called Pete, Biggles, and Jasmine."
The [do...while](/en-US/docs/Web/JavaScript/Reference/Statements/do...while) loop is very similar, but provides a variation on the while structure:

```
```js-nolint
initializer
do {
// code to run
Expand Down Expand Up @@ -947,23 +947,23 @@ Let's have a look at them all again.

First `for...of`:

```
```js-nolint
for (const item of array) {
// code to run
}
```

`for`:

```
```js-nolint
for (initializer; condition; final-expression) {
// code to run
}
```

`while`:

```
```js-nolint
initializer
while (condition) {
// code to run
Expand All @@ -974,7 +974,7 @@ while (condition) {

and finally `do...while`:

```
```js-nolint
initializer
do {
// code to run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ Next, we use a couple of [`if ()`](/en-US/docs/Web/JavaScript/Reference/Statemen

So, a complete URL would end up looking something like this:

```
```url
https://api.nytimes.com/svc/search/v2/articlesearch.json?api-key=YOUR-API-KEY-HERE&page=0&q=cats&fq=document_type:("article")&begin_date=20170301&end_date=20170312
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,13 @@ textarea.onkeyup = function () {

In this last exercise, the array contains a bunch of strings containing information about train stations in the North of England. The strings are data items that contain the three-letter station code, followed by some machine-readable data, followed by a semicolon, followed by the human-readable station name. For example:

```
```plain
MAN675847583748sjt567654;Manchester Piccadilly
```

We want to extract the station code and name, and put them together in a string with the following structure:

```
```plain
MAN: Manchester Piccadilly
```

Expand Down
10 changes: 5 additions & 5 deletions files/en-us/learn/javascript/first_steps/variables/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ For these reasons and more, we recommend that you use `let` in your code, rather

> **Note:** If you are trying this code in your browser's console, prefer to copy & paste each of the code blocks here as a whole. There's a [feature in Chrome's console](https://goo.gle/devtools-const-repl) where variable re-declarations with `let` and `const` are allowed:
>
> ```
> > let myName = 'Chris';
> let myName = 'Bob';
> ```plain
> > let myName = "Chris";
> let myName = "Bob";
> // As one input: SyntaxError: Identifier 'myName' has already been declared
>
> > let myName = 'Chris';
> > let myName = 'Bob';
> > let myName = "Chris";
> > let myName = "Bob";
> // As two inputs: both succeed
> ```
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/learn/javascript/objects/basics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const person = {};

Now open your browser's [JavaScript console](/en-US/docs/Learn/Common_questions/Tools_and_setup/What_are_browser_developer_tools#the_javascript_console), enter `person` into it, and press <kbd>Enter</kbd>/<kbd>Return</kbd>. You should get a result similar to one of the below lines:

```
```plain
[object Object]
Object { }
{ }
Expand Down
Loading

0 comments on commit 8d0cbea

Please sign in to comment.