File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const fs = require ( "fs" ) ;
2+ const path = require ( "path" ) ;
3+
4+ const DOCS_DIR = path . join ( __dirname , ".." , "docs" ) ;
5+ const OUTPUT_FILE = path . join ( __dirname , ".." , "docs-index.html" ) ;
6+
7+ const RAW_BASE =
8+ "https://raw.githubusercontent.com/DeveloperTryingToCodeLikeOtherOfThem/pxt-hardware-programming-docs/master/docs/" ;
9+
10+ function generate ( ) {
11+ const files = fs . readdirSync ( DOCS_DIR )
12+ . filter ( f => f . endsWith ( ".md" ) ) ;
13+
14+ const links = files . map ( f => {
15+ return `<li><a href="${ RAW_BASE } ${ f } " target="_blank">${ f } </a></li>` ;
16+ } ) . join ( "\n" ) ;
17+
18+ const html = `
19+ <html>
20+ <head><title>Docs Index</title></head>
21+ <body>
22+ <h1>Documentation Files</h1>
23+ <ul>
24+ ${ links }
25+ </ul>
26+ </body>
27+ </html>
28+ ` ;
29+
30+ fs . writeFileSync ( OUTPUT_FILE , html ) ;
31+ console . log ( "Generated docs-index.html" ) ;
32+ }
33+
34+ generate ( ) ;
You can’t perform that action at this time.
0 commit comments