Files
twtxt-lib/public/demo/overview-example-result.js
Eric Woodward 1c06197be0 resolve issue with missing vite-plugin-node-polyfills
add LibreJS licenses to all demo JS
split browser build from node build
add copyright info to license files
update to use yarn v4.13.0
update to v0.9.2
2026-03-07 20:47:14 -05:00

41 lines
1009 B
JavaScript

// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
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);
}
})();
// @license-end