Skip to content

Commit c99df1f

Browse files
committed
Improve styling of <details><summary>
- Add epp and epl-license-feature to the approved list. - Ensure that the hash target is selected and visible. - Fix link to the blob URL of a non-approved github repo. - Handle a *.md file that starts with <. - Add a link to simrel in the markdown nav.
1 parent b7f7696 commit c99df1f

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

markdown/index.html

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,30 @@
9595
overflow-y: auto;
9696
}
9797

98+
details>summary {
99+
margin-bottom: 0.5em;
100+
}
101+
102+
details>summary::before {
103+
content: '▷️ ';
104+
color: orange;
105+
}
106+
107+
details[open]>summary::before {
108+
content: '◢ ';
109+
color: orange;
110+
}
111+
112+
:target {
113+
border-style: solid;
114+
border-width: 1px;
115+
}
116+
117+
#edit-markdown-link {
118+
display: block;
119+
margin-bottom: 1em;
120+
}
121+
98122
/*]]>*/
99123
</style>
100124
</head>
@@ -123,6 +147,9 @@
123147
"eclipse-equinox/p2": "Equinox p2",
124148
"eclipse-ide/.github": "Eclipse IDE",
125149
"eclipse-simrel/.github": "Eclipse SimRel",
150+
"eclipse-packaging/packages": "Eclipse Packaging Project",
151+
"eclipse-orbit/.github": "Eclipse Orbit",
152+
"eclipse-cbi/epl-license-feature": "EPL License Feature",
126153
};
127154

128155
function getFileParameter() {
@@ -249,10 +276,10 @@ <h2>Table of Contents</h2>
249276

250277
const headings = markedGfmHeadingId.getHeadingList();
251278
const headingText = `
252-
<ul id="table-of-contents">
253-
${headings.map(({id, raw, level}) => `<li class="tl${level}"><a href="#${id}">${raw}</a></li>`).join(' ')}
254-
</ul>
255-
`;
279+
<ul id="table-of-contents">
280+
${headings.map(({id, raw, level}) => `<li class="tl${level}"><a href="#${id}">${raw}</a></li>`).join(' ')}
281+
</ul>
282+
`;
256283
document.getElementById('toc-target').replaceChildren(...toElements(headingText));
257284

258285
const imgs = targetElement.querySelectorAll("img[src]");
@@ -314,6 +341,11 @@ <h2>Table of Contents</h2>
314341
}
315342

316343
document.getElementById('edit-markdown-link').href = `https://github.com/${org}/${repo}/blob/${branch}/${path}`;
344+
345+
// Ensure that we nagivate to the target.
346+
if (document.location.hash.includes('#')) {
347+
document.location.hash = document.location.hash;
348+
}
317349
}
318350
}
319351

@@ -340,13 +372,13 @@ <h2>Table of Contents</h2>
340372
targetElement.innerHTML = 'No well-formed query parameter of the form <code>?file=org/repo/branch/path</code> has been specified.';
341373
} else {
342374
if (repoName == null) {
343-
const url = `https://github.com/${org}/${repo}/${branch}/${path}`;
375+
const url = `https://github.com/${org}/${repo}/blob/${branch}/${path}`;
344376
targetElement.innerHTML = `
345377
<div>
346378
The repository ${org}/${repo} is not on the allowed list.
347379
</div>
348380
<ul>
349-
<li><a href="{$url}${window.location.hash}">${url}</a></li>
381+
<li><a href="${url}${window.location.hash}">${url}</a></li>
350382
</ul>
351383
`;
352384
} else {
@@ -372,7 +404,7 @@ <h2>Table of Contents</h2>
372404
fetch(url).then(response => {
373405
return response.text();
374406
}).then(text => {
375-
if (text.startsWith('<')) {
407+
if (text.startsWith('<') && !url.toString().endsWith('.md')) {
376408
if (text.startsWith('<img') || text.match(/<ul><li><a href="[^"]+"> Parent Directory<\/a><\/li>/)) {
377409
const links = [...text.matchAll(/href="([^./][^"]+?(\.md|\/))"/g).map(match => {
378410
return {url: `https://api.github.com/repos/${org}/${repo}/contents/${path}/${match[1]}?ref=${branch}`};

project.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ let markdownAside = `
7777
<a href="${markdownBase}eclipse-pde/eclipse.pde/master/docs">PDE</a>
7878
<a href="${markdownBase}eclipse-equinox/p2/master/docs">Equinox p2</a>
7979
<a href="${markdownBase}eclipse-ide/.github/main/">Eclipse IDE</a>
80+
<a href="${markdownBase}eclipse-simrel/.github/profile/README.md">Eclipse SimRel</a>
8081
`;
8182

8283
let defaultAside = toElements(`

0 commit comments

Comments
 (0)