https://github.com/dbspt/scorpion-html
Scorpion-core support pack
https://github.com/dbspt/scorpion-html
Last synced: 2 months ago
JSON representation
Scorpion-core support pack
- Host: GitHub
- URL: https://github.com/dbspt/scorpion-html
- Owner: dbspt
- License: mit
- Created: 2022-07-21T03:30:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-25T07:35:37.000Z (almost 4 years ago)
- Last Synced: 2025-12-27T14:10:54.542Z (6 months ago)
- Language: TypeScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Scorpion HTML
[](http://commitizen.github.io/cz-cli/)
Scorpion-core support pack.
### Installation
```console
$ npm install @dbservices/scorpion-html
```
### Features, Usage, and Examples
- **Use tagged template literals as an HTML template engine.** For example:
```typescript
import html from "@dbservices/scorpion-html";
console.log(html`
${"Scorpion HTML"}
`); // => Scorpion HTML
```
- **Safe by default.** For example:
```typescript
console.log(html`
${`alert(1);`}
`); // => <script>alert(1);</script>
```
- **Unsafely interpolate trusted HTML with `$${...}`.** For example:
```typescript
console.log(html`
$${`Scorpion HTML`}
`); // => Scorpion HTML
```
- **Join interpolated arrays.** For example:
```typescript
console.log(html`
${["Scorpion", " ", "HTML"]}
`); // => Scorpion HTML
```
Array interpolations are safe by default; if you wish to unsafely interpolate an array of trusted HTML use `$${[...]}`.