initial public commit

This commit is contained in:
2026-02-22 21:26:15 -05:00
commit 9dbf7ae796
100 changed files with 18823 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { loadAndParseTwtxtFile } from "/dist-browser/twtxt-lib.js";
// run in an IIFE (or event listener) to avoid issues with top-level await
(async () => {
try {
const parsedFile = await loadAndParseTwtxtFile(
"/twtxt-demos/demo-hipster-twtxt.txt",
);
console.log(parsedFile);
document.getElementById("tabOverview-example")?.insertAdjacentHTML(
"beforeend",
`
<details open="true">
<summary>Result</summary>
<figure>
<pre id="preResult">${JSON.stringify(
parsedFile,
null,
2,
).replace(
// to color properties
/"\w+":/g,
(val) => `<span class="code-str">${val}</span>`,
)}</pre>
</figure>
</details>
`,
);
document.body.classList.add("isLoaded");
} catch (err) {
console.error(err);
}
})();