Gathering detailed insights and metrics for hyperscript-markup
Gathering detailed insights and metrics for hyperscript-markup
Gathering detailed insights and metrics for hyperscript-markup
Gathering detailed insights and metrics for hyperscript-markup
npm install hyperscript-markup
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
11 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Aug 11, 2017
Latest Version
1.0.2
Package Id
hyperscript-markup@1.0.2
Size
13.96 kB
NPM Version
3.10.8
Node Version
6.9.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
This is a Babel plugin that transpiles markup into hyperscript. Compatible with any hyperscript library that accepts hyperscript in the form of hyperscriptFunction(tag, attributes, [children])
. Works with React, Mithril, and Hyperapp.
Views are declared by the magic sequence $>
. This will transpile the template that follows it into hyperscript calls.
You can specify which hyperscript function to call like this:
$>
-- Transpile to React.createElement()
.$m>
-- Transpile to m()
.$h>
-- Transpile to h()
.$yourFunc>
-- Transpile to yourFunc()
.1const view = $> 2 (div.intro) 3 (ul) 4 (li > 'Some') 5 (li > 'List items') 6 (ul.another-list) 7 (list => item) 8 (li > item) 9 (form) 10 (input(type="text", value = "Text value", onfocus = focus)) 11 (input(type="checkbox", required=true) 12 ('Check this') 13 14ReactDOM.render(view, document.getElementById('react-app'))
Any html element can be expressed in parentheses:
1(img)
CSS classes can be set using the .
operator:
1(img.my-class-name.my-other-class-name)
An element id can be set with the +
operator (as # wouldn't be valid haxe syntax):
1(img+my-id)
Attributes can be used inside the selector:
1(img(src="img.jpg"))
Attributes can also be expressed separately:
1(img(src="img.jpg", alt="")) 2(img(src="img.jpg", aFunctionCallReturningAttributes()))
A component needs to have it's first letter capitialized:
1(div) 2 (MyComponent(param=1)) 3 (MyOtherComponent(param=2))
A shortcut for defining one child:
1(h1 > 'My title')
More than one child can be nested by using indentation:
1 (nav) 2 (ul.links) 3 (li) 4 (a(href="http://haxe.org") > 'Haxe') 5 (li) 6 (a(href="http://github.com") > 'Github')
Strings and template strings are supported.
1(h1) 2 ('A string for example') 3(button) 4 (`${this.buttonLabel}`)
Prefix an expression or identifier with the tilde operator ~
to embed an expression without a call to the hyperscript functor.
1(div) 2 (~expression)
Would translate to:
1React.createElement('div', {}, expression)
$if
, $elseif
, and $else
can be used inside templates:
1($if (headerSize == 1)) 2 (h1 > 'Big') 3($elseif (headerSize == 2)) 4 (h2 > 'Not that big') 5($else) 6 (p > 'Paragraph')
The following syntax can be used for any object (in this case links
) with a map method:
1(links => link) 2 (a (href=link.url, target='_blank') > link.title)
Using the >>
operator adds a null check prior to map execution.
1(links >> link) 2 (a (href=link.url, target='_blank') > link.title) 3
Translates to:
1if (links != null) 2 links.map(function(link) React.createElement('a', { href: link.url, target: '_blank' }, [ link.title ]); 3else 4 [];
An example can be found at examples/simple
.
Initial build:
1cd examples/simple 2npm install 3npm run build 4cd htdocs 5see index.html
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More