New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

content-kit-compiler

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-kit-compiler - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

15

package.json
{
"name": "content-kit-compiler",
"version": "0.1.6",
"description": "Compiler for content-kit suite: parses markup to json and renders json to markup",
"version": "0.2.0",
"description": "Parses and renders content to and from the JSON model that backs ContentKit's WYSIWYG Editor",
"repository": "https://github.com/bustlelabs/content-kit-compiler",

@@ -21,10 +21,11 @@ "main": "dist/content-kit-compiler.js",

"devDependencies": {
"content-kit-utils": "0.1.1",
"esperanto": "^0.6.13",
"gulp": "^3.8.10",
"content-kit-utils": "0.1.2",
"esperanto": "^0.6.31",
"gulp": "^3.8.11",
"gulp-file": "^0.2.0",
"gulp-jshint": "^1.9.2",
"gulp-jshint": "^1.10.0",
"gulp-qunit": "^1.2.1",
"qunitjs": "^1.17.1"
"jsdom": "3.1.2",
"qunitjs": "^1.18.0"
}
}

@@ -1,4 +0,4 @@

# ContentKit-Compiler [![Build Status](https://travis-ci.org/bustlelabs/content-kit-compiler.svg?branch=master)](https://travis-ci.org/bustlelabs/content-kit-compiler)
# ContentKit Compiler [![Build Status](https://travis-ci.org/bustlelabs/content-kit-compiler.svg?branch=master)](https://travis-ci.org/bustlelabs/content-kit-compiler)
Parses HTML to ContentKit's JSON schema and renders back to HTML.
Parses and renders content to and from the JSON model that backs ContentKit's WYSIWYG Editor

@@ -94,5 +94,2 @@ ### Examples

#### Customization & Hooks
API currently in flux
## Building / Testing

@@ -99,0 +96,0 @@ ```

@@ -0,3 +1,8 @@

import Compiler from './compiler';
import ContentKit from './main';
window.ContentKit = ContentKit;
if (typeof exports === 'object') {
module.exports = Compiler;
} else {
window.ContentKit = ContentKit;
}

@@ -8,9 +8,32 @@ import BlockModel from '../models/block';

import { trim, trimLeft, sanitizeWhitespace } from 'content-kit-utils/src/string-utils';
import { DOMParsingNode, textOfNode, unwrapNode, attributesForNode } from 'content-kit-utils/src/node-utils';
import { textOfNode, unwrapNode, attributesForNode } from 'content-kit-utils/src/node-utils';
var ELEMENT_NODE = window.Node && Node.ELEMENT_NODE || 1;
var TEXT_NODE = window.Node && Node.TEXT_NODE || 3;
var ELEMENT_NODE = 1;
var TEXT_NODE = 3;
var defaultAttributeBlacklist = { 'style' : 1, 'class' : 1 };
/**
* Abstracted `document` between node.js and browser
*/
var parserDocument = (function() {
// node.js
if (typeof exports === 'object') {
var jsdom = require('jsdom').jsdom;
return jsdom();
}
// A document instance separate from the html page document. (if browser supports it)
// Prevents images, scripts, and styles from executing while parsing
var implementation = document.implementation;
var createHTMLDocument = implementation.createHTMLDocument;
if (createHTMLDocument) {
return createHTMLDocument.call(implementation, '');
}
// return standard browser document
return document;
}());
/**
* Returns the last block in the set or creates a default block if none exist yet.

@@ -61,5 +84,6 @@ */

HTMLParser.prototype.parse = function(html) {
DOMParsingNode.innerHTML = sanitizeWhitespace(html);
var parsingNode = parserDocument.createElement('div');
parsingNode.innerHTML = sanitizeWhitespace(html);
var nodes = toArray(DOMParsingNode.childNodes);
var nodes = toArray(parsingNode.childNodes);
var nodeCount = nodes.length;

@@ -66,0 +90,0 @@ var blocks = [];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc