Gathering detailed insights and metrics for @wikifactory/slate-hyperprint
Gathering detailed insights and metrics for @wikifactory/slate-hyperprint
Gathering detailed insights and metrics for @wikifactory/slate-hyperprint
Gathering detailed insights and metrics for @wikifactory/slate-hyperprint
A library to convert Slate models to their slate-hyperscript representation
npm install @wikifactory/slate-hyperprint
Typescript
Module System
Node Version
NPM Version
JavaScript (88.41%)
CSS (9.2%)
HTML (2.39%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
1 Stars
103 Commits
4 Watchers
1 Branches
4 Contributors
Updated on Dec 28, 2018
Latest Version
3.0.0
Package Id
@wikifactory/slate-hyperprint@3.0.0
Unpacked Size
247.61 kB
Size
63.73 kB
File Count
73
NPM Version
6.5.0
Node Version
11.4.0
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
1
23
A library to convert Slate models to their slate-hyperscript representation.
You can use @wikifactory/slate-hyperprint
as a library to:
See the online demo, that converts a Slate JSON representation to a Slate hyperscript representation.
yarn add @wikifactory/slate-hyperprint [--dev]
1import Slate from 'slate'; 2import hyperprint from '@wikifactory/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(...))
@wikifactory/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 @wikifactory/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 0/30 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
Reason
77 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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