Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
SIML is the Simplified Markup Language. It is a conceptual hybrid strongly inspired by the simplicity of CSS selectors and SASS-style nesting.
No, SIML isn't a templating language. It doesn't currently provide constructs for including data, controlling flow or looping. Reasoning behind this:
SIML allows you to write HTML with more ease and less cruft. "SIML" is the name of the language, and also the utility for converting the language to HTML.
You can specify your elements through CSS selectors:
div -> <div></div>
p.foo[baz] -> <p class="foo" baz></p>
div#x.ace -> <div id="x" class="ace"></div>
em > span -> <em><span></span></em>
em 'Ok then' -> <em>Ok then</em>
Ok, the last one wasn't a CSS selector, it included a string. But it makes sense, right?
SIML allows nesting with curlies, just like Sassy CSS:
section.body {
h1#title {
'Title'
}
}
Or significant whitespace (i.e. indent to nest):
section.body
h1#title
'Title'
But you're not forced to build hierarchies with nesting; you can do one-liners instead:
section.body > h1#title 'Title'
That'll give you:
<section class="body">
<h1 id="title">
Title
</h1>
</section>
As shown, SIML gives you the expressive power of CSS selectors. It also supports Attributes, Text and Directives.
section { // Selector
class: body // Attribute
' foo blah ' // Text directive
text: 'foo' // Custom Text Attribute
@foo(1,2,3) // Custom directive
}
Note: You can extend SIML to support your own attributes, directives and psuedo-classes. For an example see generators/angular.js
SIML allows you to express more with less effort and, perhaps, more clarity:
section.contact > form
h2 'Enter contact details'
label[for=name]
'Your name?'
input#name
label[for=human]
'Are you human?'
input:checkbox#human
input:submit 'Submit form...'
That would give you:
<section class="contact">
<form>
<h2>
Enter contact details
</h2>
<label for="name">
Your name?
<input id="name"/>
</label>
<label for="human">
Are you human?
<input type="checkbox" id="human"/>
</label>
<input type="submit"/>
</form>
</section>
Nope. SIML has some hidden gems. Some are still being tweaked.
For example, you can use the syntax (.../.../...)
to form an ExclusiveGroup which will make SIML expand a hierarchy to conform to the alternates you specify:
a (b/c) // <a><b></b></a><a><c></c></a>
The above would be the same as writing:
a b
a c
A more useful example:
ul li ('wow'/'this'/'is'/'cool')
Becomes:
<ul>
<li>wow</li>
<li>this</li>
<li>is</li>
<li>cool</li>
</ul>
Another cool feature is multipliers (looks like a numeric psuedo class):
div a:3
Becomes:
<div>
<a></a>
<a></a>
<a></a>
</div>
SIML allows you to make your own SIML generator by configuring:
This means, with a bit of configuration, you can write custom markup for your bespoke need. E.g.
This uses the angular generator which converts directives and undefined pseudo-classes to ng-
attributes.
ul#todo-list > li
@repeat( todo in todos | filter:statusFilter )
@class({
completed: todo.completed,
editing: todo == editedTodo
})
This would become:
<ul id="todo-list">
<li
ng-repeat="todo in todos | filter:statusFilter"
ng-class="{ completed: todo.completed, editing: todo == editedTodo }"
></li>
</ul>
More info on AngularJS in SIML
dist/siml.js
: This is the default generator. No fancy stuff. Not even input:checkbox
support.dist/siml.html5.js
: For now, this includes small things like doctype()
support and input:type
suppport.dist/siml.angular.js
: This is the angular generator, which makes it easier to write ng-...
attributes with directives/pseudo-classes. (Example here). Currently also includes input:type
support.dist/siml.all.js
: This includes html5 and angular.<script src="dist/siml.all.min.js"></script>
<script>
siml.html5.parse('a.foo#blah{span "ok"}', {
curly: false, // [default=false] pass true if you're using curlies for hierarchy
pretty: false, // [default=true] Will give you pretty HTML
indent: '....' // [default=' '] Use custom indentation when pretty=true
});
// Generates:
// <a id="blah" class="foo">
// ....<span>
// ........ok
// ....</span>
// </a>
</script>
npm install siml
var siml = require('siml');
// Using the html5 generator (e.g. to support :checkbox)
siml.html5.parse('input:checkbox'; // => '<input type="checkbox" />'
More to come...
html hd{meta[charset=utf-8]+title{'Cool'}} bdy
(a/b)
) and InclusiveGroups (a+b,d
)selector:n
). See Issue #6%HTML_TOKEN%
tokens in the output.FAQs
SIML, Simpified markup inspired by CSS
The npm package siml receives a total of 1 weekly downloads. As such, siml popularity was classified as not popular.
We found that siml 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.