-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
301 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"useTabs": true | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
const hljs = require("highlight.js"); | ||
const md = require("markdown-it")({ | ||
highlight: function(str, lang) { | ||
if (lang && hljs.getLanguage(lang)) { | ||
try { | ||
return hljs.highlight(str, { language: lang }).value; | ||
} catch (err) { | ||
console.err("Highlighting failed:", err); | ||
} | ||
} | ||
highlight: function (str, lang) { | ||
if (lang && hljs.getLanguage(lang)) { | ||
try { | ||
return hljs.highlight(str, { language: lang }).value; | ||
} catch (err) { | ||
console.err("Highlighting failed:", err); | ||
} | ||
} | ||
|
||
return ""; // use external default escaping | ||
} | ||
return ""; // use external default escaping | ||
}, | ||
}); | ||
const ejs = require("ejs"); | ||
const fsp = require("fs").promises; | ||
|
||
async function init() { | ||
const readmeSrc = await fsp.readFile("./README.md", "utf8"); | ||
const readme = md.render(readmeSrc); | ||
const readmeSrc = await fsp.readFile("./README.md", "utf8"); | ||
const readme = md.render(readmeSrc); | ||
|
||
await fsp.mkdir("website").catch(e => {}); | ||
await fsp.copyFile("./dist/esm/index.js", "./website/wasm-feature-detect.js"); | ||
await fsp.copyFile( | ||
"./node_modules/highlight.js/styles/github.css", | ||
"./website/syntax.css" | ||
); | ||
await fsp.mkdir("website").catch((e) => {}); | ||
await fsp.copyFile("./dist/esm/index.js", "./website/wasm-feature-detect.js"); | ||
await fsp.copyFile( | ||
"./node_modules/highlight.js/styles/github.css", | ||
"./website/syntax.css" | ||
); | ||
|
||
const template = await fsp.readFile("./website.ejs", "utf8"); | ||
const output = ejs.render(template, { readme }); | ||
await fsp.writeFile("./website/index.html", output); | ||
const template = await fsp.readFile("./website.ejs", "utf8"); | ||
const output = ejs.render(template, { readme }); | ||
await fsp.writeFile("./website/index.html", output); | ||
} | ||
|
||
init(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.