Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsox support #176

Open
JounQin opened this issue Jun 30, 2022 · 3 comments
Open

jsox support #176

JounQin opened this issue Jun 30, 2022 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@JounQin
Copy link
Collaborator

JounQin commented Jun 30, 2022

https://github.com/repetere/jsonx#readme

https://github.com/d3x0r/jsox

This maybe cover #4 at the same time.

@ota-meshi
Copy link
Owner

Thank you for posting issue.

But I still don't understand.
It looks like JavaScript syntax. Do we need to process JSON to check jsonx?
Haven't I reached that document yet?

import { * as jsonx } from 'jsonx';
const example_JXM_JSON = {
  component:'p',
  props:{ style:{ color:'blue' } },
  children:'hello world'
};

//Rendering React Components
jsonx.getReactElement(example_JXM_JSON); // => JSX Equivalent: <p style={{color:'blue'}}>hello world</p>

//Generating HTML strings
jsonx.outputHTML({ jsonx: example_JXM_JSON, }); // => '<p style="color:blue;">hello world</p>'

//Generating JSX strings
jsonx.outputJSX({ jsonx: example_JXM_JSON, }); // => '<p style={{color:blue,}}>hello world</p>'

//Rendering HTML Dom with React
jsonx.jsonxRender({ jsonx: example_JXM_JSON, querySelector:'#myApp', });
// <!DOCTYPE html>
//  <body>
//    <div id="myApp">
//      <p style="color:blue;">hello world</p>
//    </div>
// </body>

//you can also use the simplified syntax
const simpleJXM_JSON = {
  p:{
    props:{ style:{ color:'blue' } },
    children:'hello world'
  }
}

//or if you have an element with no props, simply use {type:children}
const superSimpleJXM = {
  ul:[
    {li:'first!'},
    {li:'second!'},
  ]
}

@JounQin
Copy link
Collaborator Author

JounQin commented Jul 1, 2022

Ah, I'm so sorry, actually I mean JSOX.

@JounQin JounQin changed the title jsonx support jsox support Jul 1, 2022
@ota-meshi
Copy link
Owner

I get it 😄

@ota-meshi ota-meshi added the enhancement New feature or request label Jul 1, 2022
@JounQin JounQin added the help wanted Extra attention is needed label Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants