
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.
@geooot/soul-patch
Advanced tools
Generating HTML through means that are not efficient, or safe. But it gets the job done. (and just want's to have a good time!)
A HTML templator with angular like syntax. Generating HTML through means that are not efficient, or safe. Only really good for shady static site generation.
If moustache and handlebars are real templating engines, then soul-patch is it's wierd distant cousin.
$ npm install @geooot/soul-patch
const { renderPage } = require('stubble');
const template = `
<ul sp-for="let i=0; i<3; i++">
<li sp-assign="text: foo + someFunc(i), class: 'whatever'"></li>
</ul>
`
let rendered = await renderPage({
input: template,
props: {
foo: "The number is: ",
someFunc: (num) => num * 100
}
});
console.log(rendered);
// Results in:
// <ul>
// <li class="whatever">The number is: 0</li>
// <li class="whatever">The number is: 100</li>
// <li class="whatever">The number is: 200</li>
// </ul>
Operators allow you to template html by adding special attributes to your HTML. Here are the available operators:
sp-assignThis property allows you to assign variables to HTML attributes and set HTML.
This template:
<p sp-assign="text: someVariable, class: someBool ? 'text-green' : 'text-red'">Whatever</p>
Results in:
<p class="text-red">I was a string assigned to someVariable</p>
This template:
<p sp-assign="innerHTML: markdownToHTML(markdownInAString)"></p>
Results in:
<p><h1>Here is some raw HTML being injected!!!</h1><p>wowzers</p></p>
sp-forDefines how you can create a loop of elements.
This template:
<ul sp-for="let i=0; i<10; i++">
<li sp-assign="text: i, class: 'whatever'">
Anything can go here but it will probably be replaced on render
</li>
</ul>
Results in:
<ul>
<li class="whatever">0</li>
<li class="whatever">1</li>
<li class="whatever">2</li>
<li class="whatever">3</li>
<li class="whatever">4</li>
<li class="whatever">5</li>
<li class="whatever">6</li>
<li class="whatever">7</li>
<li class="whatever">8</li>
<li class="whatever">9</li>
</ul>
This template
<div sp-for="item of listOfObjects">
<p sp-assign="text: item.name, id: item.id">Whatever</p>
</div>
Results in
<div>
<p id="someIdFoo">Foo</p>
<p id="someIdBar">Bar</p>
<p id="someIdWiz">Wiz</p>
</div>
sp-render-ifRenders an item if a certain condition is true
This template:
<p sp-render-if="10 < 100">Turns out 10 is less than 100 so this will render</p>
<p sp-render-if="myIQ > averageIQForAge(19)">But my IQ is below average so this will not render</p>
Results in:
<p>Turns out 10 is less than 100 so this will render</p>
FAQs
Generating HTML through means that are not efficient, or safe. But it gets the job done. (and just want's to have a good time!)
We found that @geooot/soul-patch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

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

Product
Bringing supply chain security to the next generation of JavaScript package managers