Skip to content

Commit 982bcdb

Browse files
authored
Add a note/hint to discuss H1 removal of extension title for extension info pages (microsoft#11064)
* note the removal of the first h1 * revise heading duplication removal info * why not over describe things * spelling
1 parent e0f9476 commit 982bcdb

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎docs/extensions/naming-conventions.md‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,52 @@ Your extension name (defined in [pxt.json](./pxt-json.md)) must adhere to the fo
1818

1919
In other words, it should match the following regex: `^[a-z][a-z0-9\-_]+`.
2020

21+
### ~ reminder
22+
23+
#### Headings in the Extensions Gallery info pages
24+
25+
To display the information page for an extension (when you click `Learn more` on an extension card in the Extensions Gallery) the Editor will inject portions of the `README.md` file from the extension's repository. A new top-level heading (`h1`), in addition to the one from the `README.md`, is generated for this page. The new heading might contain something like `theowner/pxt-laser-ray 1.2.3`, depending on the repository, owner, and version.
26+
27+
The rendering process for the extension's information page will attempt to remove the original `h1` element that came from `README.md` in order to avoid name duplication in the page headings. This is done by looking for the heading from the `README.md` that contains the `name` entry from the `pxt.json` in the repository. If found, that heading is removed. However, if the heading from the `README.md` doesn't match the `name` from `pxt.json`, then that `h1` heading isn't removed and it will also display in the extension information page.
28+
29+
If `pxt.json` file contains:
30+
31+
```
32+
"name": "pxt-laser-ray",
33+
"version": "1.2.3",
34+
"description": "Generate light effects to simulate laser rays."
35+
```
36+
37+
...but the `README.md` contains:
38+
39+
```
40+
# Cool Laser Ray
41+
42+
This extension contains blocks to create laser ray effects.
43+
44+
...
45+
```
46+
47+
...instead of:
48+
49+
```
50+
# pxt-laser-ray
51+
52+
This extension contains blocks to create laser ray effects.
53+
54+
...
55+
```
56+
57+
...then the information page will contain both:
58+
59+
`<h1>theowner/pxt-laser-ray 1.2.3</h1>`
60+
61+
and
62+
63+
`<h1>Cool Laser Ray</h1>`
64+
65+
### ~
66+
2167
## TypeScript conventions
2268

2369
MakeCode follows the usual TypeScript naming conventions.

0 commit comments

Comments
 (0)