Hnxml Standard is a TypeScript-based XML schema specification for Hacknet
extensions, and it is defined by hnxml.js
. hnxml.js
also provides
JSX-compatible authoring support and additional generator tools for
Hacknet-related content generating.
Note: This project is currently in active development and may not lyet fuly implement all specifications.
You can access Hnxml Standard through:
hnxml.js
with JSXAdd package @modernschoolproject/hnxml
via deno
# deno
deno add jsr:@modernschoolproject/hnxml
# npm
npx jsr add @modernschoolproject/hnxml
# yarn
yarn add jsr:@modernschoolproject/hnxml
# pnpm
pnpm i jsr:@modernschoolproject/hnxml
# bun
bunx jsr add @modernschoolproject/hnxml
Edit compilerOptions
in tsconfig.json
or deno.json
{
"compilerOption": {
"jsx": "react-jsx",
"jsxImportSource": "@modernschoolproject/hnxml"
}
}
Then declare JSX.IntrinsicElements
for the Hacknet Extension XML types you
want to generate.
For example, if you want to use Mission
:
import { render } from "@modernschoolproject/hnxml";
declare module "@modernschoolproject/hnxml/jsx-runtime" {
namespace JSX {
type IntrinsicElements =
import("@modernschoolproject/hnxml/jsx/mission").Elements;
}
}
console.log(
render(
<mission
id="missionID"
activeCheck="true"
shouldIgnoreSenderVerification="true"
>
...
</mission>,
).end({ headless: true, allowEmptyTags: true }),
);