95
95
overflow-y : auto;
96
96
}
97
97
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
+
98
122
/*]]>*/
99
123
</ style >
100
124
</ head >
123
147
"eclipse-equinox/p2" : "Equinox p2" ,
124
148
"eclipse-ide/.github" : "Eclipse IDE" ,
125
149
"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" ,
126
153
} ;
127
154
128
155
function getFileParameter ( ) {
@@ -249,10 +276,10 @@ <h2>Table of Contents</h2>
249
276
250
277
const headings = markedGfmHeadingId . getHeadingList ( ) ;
251
278
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
+ ` ;
256
283
document . getElementById ( 'toc-target' ) . replaceChildren ( ...toElements ( headingText ) ) ;
257
284
258
285
const imgs = targetElement . querySelectorAll ( "img[src]" ) ;
@@ -314,6 +341,11 @@ <h2>Table of Contents</h2>
314
341
}
315
342
316
343
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
+ }
317
349
}
318
350
}
319
351
@@ -340,13 +372,13 @@ <h2>Table of Contents</h2>
340
372
targetElement . innerHTML = 'No well-formed query parameter of the form <code>?file=org/repo/branch/path</code> has been specified.' ;
341
373
} else {
342
374
if ( repoName == null ) {
343
- const url = `https://github.com/${ org } /${ repo } /${ branch } /${ path } ` ;
375
+ const url = `https://github.com/${ org } /${ repo } /blob/ ${ branch } /${ path } ` ;
344
376
targetElement . innerHTML = `
345
377
<div>
346
378
The repository ${ org } /${ repo } is not on the allowed list.
347
379
</div>
348
380
<ul>
349
- <li><a href="{$ url}${ window . location . hash } ">${ url } </a></li>
381
+ <li><a href="${ url } ${ window . location . hash } ">${ url } </a></li>
350
382
</ul>
351
383
` ;
352
384
} else {
@@ -372,7 +404,7 @@ <h2>Table of Contents</h2>
372
404
fetch ( url ) . then ( response => {
373
405
return response . text ( ) ;
374
406
} ) . then ( text => {
375
- if ( text . startsWith ( '<' ) ) {
407
+ if ( text . startsWith ( '<' ) && ! url . toString ( ) . endsWith ( '.md' ) ) {
376
408
if ( text . startsWith ( '<img' ) || text . match ( / < u l > < l i > < a h r e f = " [ ^ " ] + " > P a r e n t D i r e c t o r y < \/ a > < \/ l i > / ) ) {
377
409
const links = [ ...text . matchAll ( / h r e f = " ( [ ^ . / ] [ ^ " ] + ?( \. m d | \/ ) ) " / g) . map ( match => {
378
410
return { url : `https://api.github.com/repos/${ org } /${ repo } /contents/${ path } /${ match [ 1 ] } ?ref=${ branch } ` } ;
0 commit comments