Skip to content

Commit

Permalink
Merge pull request #16 from williamtroup/2.2.0
Browse files Browse the repository at this point in the history
2.2.0
  • Loading branch information
william-troup authored Sep 8, 2024
2 parents bbf5f28 + 6d35010 commit 2e3d326
Show file tree
Hide file tree
Showing 30 changed files with 701 additions and 247 deletions.
41 changes: 32 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
JHson.js

[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=JHson.js%2C%20a%20free%20JavaScript%json%20converter&url=https://github.com/williamtroup/JHson.js&hashtags=javascript,json,html,converter)
[![npm](https://img.shields.io/badge/npmjs-v2.1.0-blue)](https://www.npmjs.com/package/jhson.js)
[![nuget](https://img.shields.io/badge/nuget-v2.1.0-purple)](https://www.nuget.org/packages/JHson.js/)
[![npm](https://img.shields.io/badge/npmjs-v2.2.0-blue)](https://www.npmjs.com/package/jhson.js)
[![nuget](https://img.shields.io/badge/nuget-v2.2.0-purple)](https://www.nuget.org/packages/JHson.js/)
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/JHson.js/blob/main/LICENSE.txt)
[![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/JHson.js/discussions)
[![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://william-troup.com/)
</h1>

> <p align="center">📃 A JavaScript library for converting between HTML and JSON, with binding, templating, attributes, and CSS support.</p>
> <p align="center">v2.1.0</p>
> <p align="center">v2.2.0</p>
<br />
<br />
Expand All @@ -21,8 +21,9 @@ JHson.js
- 🦾 Written in TypeScript, allowing greater support for React, Angular, and other libraries!
- 💻 Full API available via public functions.
- 🌈 Full support for Attributes, CSS style properties, and formatted text!
- ⭐ Write your JSON directly to any DOM element for rendering.
- ⭐ Write your JSON directly to any DOM element for rendering, or get the base element for use elsewhere.
- 📋 Copy the layout for an entire page without additional files!
- 🔍 Apply additional filters to exclude specific node types, CSS styles, attributes, etc.
- 🔠 Data templating for text (with defaults support).
- 🎥 Write CSS directly back to the head for each element!
- 💧 Bind JSON directly to DOM elements!
Expand Down Expand Up @@ -55,8 +56,8 @@ npm install jhson.js
You can also use the following CDN links:

```markdown
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.1.0/dist/jhson.min.js
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.1.0/dist/jhson.export.js
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.2.0/dist/jhson.min.js
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.2.0/dist/jhson.export.js
```
<br>
<br>
Expand Down Expand Up @@ -100,33 +101,55 @@ Make sure you include the "DOCTYPE html" tag at the top of your HTML, as follows
var json = $jhson
.json()
.includeAttributes( true )
.includeDataAttributes( true )
.includeCssProperties( true )
.includeText( true )
.includeChildren( true )
.friendlyFormat( true )
.indentSpaces( 2 )
.ignoreNodeTypes( "q" )
.ignoreNodeCondition( null ),
.ignoreCssProperties( "padding" )
.ignoreAttributes( "data-your-attribute" )
.generateUniqueMissingIds( false )
.generateUniqueMissingNames( false )
.propertyReplacer( null )
.get( header );

$jhson
.html()
.json( json )
.templateData( { "{{template_data}}": "this template data" } )
.removeOriginalAttributes( true )
.removeOriginalDataAttributes( true )
.clearOriginalHTML( true )
.addCssToHead( false )
.clearCssFromHead( false )
.logTemplateDataWarnings( false )
.addAttributes( true )
.addDataAttributes( true )
.addCssProperties( true )
.addText( true )
.addChildren( true )
.insertBefore( false )
.write( header );

var element = $jhson
.html()
.json( json )
.templateData( { "{{template_data}}": "this template data" } )
.removeOriginalAttributes( true )
.removeOriginalDataAttributes( true )
.clearOriginalHTML( true )
.addCssToHead( false )
.clearCssFromHead( false )
.logTemplateDataWarnings( false )
.addAttributes( true )
.addDataAttributes( true )
.addCssProperties( true )
.addText( true )
.addChildren( true )
.get();
</script>
```

Expand Down Expand Up @@ -174,9 +197,9 @@ Configuration options allow you to customize how JHson.js will function. You ca

```markdown
<script>
$jhson.setConfiguration( {
nodeTypesToIgnore: [ "script" ]
} );
$jhson.setConfiguration( {
safeMode: false
} );
</script>
```

Expand Down
41 changes: 32 additions & 9 deletions README_NUGET.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# JHson.js v2.1.0
# JHson.js v2.2.0

[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=JHson.js%2C%20a%20free%20JavaScript%json%20converter&url=https://github.com/williamtroup/JHson.js&hashtags=javascript,json,html,converter)
[![npm](https://img.shields.io/badge/npmjs-v2.1.0-blue)](https://www.npmjs.com/package/jhson.js)
[![nuget](https://img.shields.io/badge/nuget-v2.1.0-purple)](https://www.nuget.org/packages/JHson.js/)
[![npm](https://img.shields.io/badge/npmjs-v2.2.0-blue)](https://www.npmjs.com/package/jhson.js)
[![nuget](https://img.shields.io/badge/nuget-v2.2.0-purple)](https://www.nuget.org/packages/JHson.js/)
[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/williamtroup/JHson.js/blob/main/LICENSE.txt)
[![discussions Welcome](https://img.shields.io/badge/discussions-Welcome-red)](https://github.com/williamtroup/JHson.js/discussions)
[![coded by William Troup](https://img.shields.io/badge/coded_by-William_Troup-yellow)](https://william-troup.com/)
Expand All @@ -16,8 +16,9 @@
- 🦾 Written in TypeScript, allowing greater support for React, Angular, and other libraries!
- 💻 Full API available via public functions.
- 🌈 Full support for Attributes, CSS style properties, and formatted text!
- ⭐ Write your JSON directly to any DOM element for rendering.
- ⭐ Write your JSON directly to any DOM element for rendering, or get the base element for use elsewhere.
- 📋 Copy the layout for an entire page without additional files!
- 🔍 Apply additional filters to exclude specific node types, CSS styles, attributes, etc.
- 🔠 Data templating for text (with defaults support).
- 🎥 Write CSS directly back to the head for each element!
- 💧 Bind JSON directly to DOM elements!
Expand All @@ -44,8 +45,8 @@ npm install jhson.js
You can also use the following CDN links:

```markdown
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.1.0/dist/jhson.min.js
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.1.0/dist/jhson.export.js
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.2.0/dist/jhson.min.js
https://cdn.jsdelivr.net/gh/williamtroup/JHson.js@2.2.0/dist/jhson.export.js
```


Expand Down Expand Up @@ -81,33 +82,55 @@ Make sure you include the "DOCTYPE html" tag at the top of your HTML, as follows
var json = $jhson
.json()
.includeAttributes( true )
.includeDataAttributes( true )
.includeCssProperties( true )
.includeText( true )
.includeChildren( true )
.friendlyFormat( true )
.indentSpaces( 2 )
.ignoreNodeTypes( "q" )
.ignoreNodeCondition( null ),
.ignoreCssProperties( "padding" )
.ignoreAttributes( "data-your-attribute" )
.generateUniqueMissingIds( false )
.generateUniqueMissingNames( false )
.propertyReplacer( null )
.get( header );

$jhson
.html()
.json( json )
.templateData( { "{{template_data}}": "this template data" } )
.removeOriginalAttributes( true )
.removeOriginalDataAttributes( true )
.clearOriginalHTML( true )
.addCssToHead( false )
.clearCssFromHead( false )
.logTemplateDataWarnings( false )
.addAttributes( true )
.addDataAttributes( true )
.addCssProperties( true )
.addText( true )
.addChildren( true )
.insertBefore( false )
.write( header );

var element = $jhson
.html()
.json( json )
.templateData( { "{{template_data}}": "this template data" } )
.removeOriginalAttributes( true )
.removeOriginalDataAttributes( true )
.clearOriginalHTML( true )
.addCssToHead( false )
.clearCssFromHead( false )
.logTemplateDataWarnings( false )
.addAttributes( true )
.addDataAttributes( true )
.addCssProperties( true )
.addText( true )
.addChildren( true )
.get();
</script>
```

Expand Down Expand Up @@ -146,9 +169,9 @@ Configuration options allow you to customize how JHson.js will function. You ca

```markdown
<script>
$jhson.setConfiguration( {
nodeTypesToIgnore: [ "script" ]
} );
$jhson.setConfiguration( {
safeMode: false
} );
</script>
```

Expand Down
Loading

0 comments on commit 2e3d326

Please sign in to comment.