
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@triptease/html-jsx
Advanced tools
Generate static HTML from JSX/TSX templates. The perfect solution to server side rendering of HTML, more performant than template engines with type checking for HTML.
Add the package as a dev dependency
npm add -D @triptease/html-jsx
Add the JSX configuration into the compiler options in tsconfig.json
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@triptease/html-jsx"
}
}
Write your templates using JSX/TSX, no imports required.
function greet(name: string) {
return (
<div>
<p>
Hello ${name}
</p>
</div>
);
}
Invalid HTML elements are caught at compile time
<h7></h7>
// TS2339: Property h7 does not exist on type JSX.IntrinsicElements
Invalid HTML attributes are caught at compile time
<div classs="my-class"></div>
// TS2322: Type { classs: string; } is not assignable to type HtmlTagDiv
// Property 'classs' does not exist on type HtmlTagDiv. Did you mean 'class'?
HTML attributes are type-checked
<input required="falsey"></input>
// TS2820: Type 'falsey' is not assignable to type BooleanAttribute | undefined. Did you mean 'false'?
Validation of HTML structure using the WHATWG content categories is applied at runtime when NODE_ENV is set to development.
<span>
<div></div>
</span>
Warning on console
div is not a valid child of span at /path/to/file.tsx:linenumber:position
All content of HTML tags and attributes are escaped by default to avoid XSS attacks.
Similarly to React's dangerouslySetInnerHTML, you can disable escaping by using the raw function.
import { raw } from '@triptease/html-jsx';
const content = '<script>arbitraryCode()</script>';
<div>{content}</div> // Outputs <div><script>arbitraryCode()</script></div>;
<div>{raw(content)}</div> // Outputs <div><script>arbitraryCode()</script></div>
Attribute escaping can also be disabled
import { raw } from '@triptease/html-jsx';
<hr data-x={raw('&')} /> // Outputs <hr data-x="&" />
<hr data-x={'&'} /> // Outputs <hr data-x="&" />
TODO: Add documentation
Define custom elements by extending the JSX.IntrinsicElements interface.
declare module '@triptease/html-jsx' {
namespace JSX {
interface IntrinsicElements {
'some-custom-element': {
someAttribute: string;
children?: Children;
};
}
}
}
<some-custom-element someAttribute="data">Foo</some-custom-element>
FAQs
JSX implementation for generating static HTML
We found that @triptease/html-jsx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.