Gathering detailed insights and metrics for slate-hyperprint
Gathering detailed insights and metrics for slate-hyperprint
Gathering detailed insights and metrics for slate-hyperprint
Gathering detailed insights and metrics for slate-hyperprint
npm install slate-hyperprint
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
24 Stars
88 Commits
10 Forks
3 Watching
19 Branches
6 Contributors
Updated on 25 Jul 2023
JavaScript (82.54%)
CSS (13.87%)
HTML (3.59%)
Cumulative downloads
Total Downloads
Last day
-98.1%
19
Compared to previous day
Last week
-87.1%
480
Compared to previous week
Last month
1,195%
9,376
Compared to previous month
Last year
170.4%
14,440
Compared to previous year
1
24
A library to convert Slate models to their slate-hyperscript representation.
You can use slate-hyperprint
as a library to:
See the online demo, that converts a Slate JSON representation to a Slate hyperscript representation.
yarn add slate-hyperprint [--dev]
1import Slate from 'slate'; 2import hyperprint from 'slate-hyperprint'; 3 4console.log( 5 hyperprint( 6 Slate.Value.create({ 7 document: Slate.Document.create({ 8 nodes: [ 9 Slate.Block.create({ 10 type: 'paragraph', 11 data: { a: 1 }, 12 nodes: [ 13 Slate.Text.create('Hello') 14 ] 15 } 16 )] 17 }) 18 }) 19 ) 20); 21// <value> 22// <document> 23// <paragraph a={1}> 24// Hello 25// </paragraph> 26// </document> 27// </value> 28 29hyperprint.log(...) 30// Equivalent to console.log(hyperprint(...))
slate-hyperprint
accepts an option object:
1hyperprint(value, options);
preserveKeys: boolean = false
True to print node keysstrict: boolean = false
True to preserve empty texts and other things that the formatting would
otherwise omit. Useful when using hyperprint compare values in tests, because
the output is stricter.prettier: Object = { semi: false, singleQuote: true, tabWidth: 4 }
Prettier config to use when formatting the output JSX.yarn run test
yarn run build
slate-hyperprint also export a command line interface tool that converts yaml files to jsx.
When installed globally (npm install slate-hyperprint --global
) it can be used like so:
$ slate-hyperprint document.yaml
It will load the file, create a Slate document and print it to the console in jsx.
Note: it will look for a value.document
, state.document
or document
property.
It will consider the whole content as the document if none are found.
You can write the output to a file like so slate-hyperprint input.yaml > output.js
Here is a command to convert a whole bunch of yaml files in a test folder:
$ for file in tests/**/*.yaml; do basename=$(echo $file | sed 's/\.yaml//'); slate-hyperprint $basename.yaml > $basename.js; done;
The React equivalent react-element-to-jsx-string is and will remain a great source of inspiration.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/20 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
72 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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