├── LICENSE ├── README.md ├── bootstrap.gif ├── editor.js ├── html2json2dom.gif ├── index.html └── to_cell.webpacked.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 gliechtenstein 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HTML to Cell 2 | 3 | A notebook that turns HTML => JSON => DOM, powered by Cell. 4 | 5 | | | Column 1 | Column 2 | Column 3 6 | |--------------|------------|----------|----------- 7 | |What it does | input HTML | HTML to JSON | JSON to DOM 8 | 9 | 10 | 11 |
12 | 13 | 14 | # Demo 15 | 16 | Check out the demo [https://gliechtenstein.github.io/HTML2JSON2DOM/](https://gliechtenstein.github.io/HTML2JSON2DOM/) 17 | 18 | # Built With 19 | 20 | 1. cell: https://github.com/intercellular/cell 21 | 2. to_cell: https://github.com/devsnek/to_cell 22 | 3. codemirror: https://github.com/codemirror/CodeMirror 23 | -------------------------------------------------------------------------------- /bootstrap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gliechtenstein/HTML2JSON2DOM/1f323cecf0b9f0bed1b93801e7a6d4ea5da4af26/bootstrap.gif -------------------------------------------------------------------------------- /editor.js: -------------------------------------------------------------------------------- 1 | CM = function(gene) { 2 | return { 3 | $type: "textarea", 4 | id: gene.id ? gene.id : null, 5 | _ed: null, 6 | _out: gene._out, 7 | _in: function(message) { 8 | if(this._ed) this._ed.setValue(message); 9 | }, 10 | _default: { 11 | mode: "xml", htmlMode: true, lineNumbers: true, lineWrapping: true, lint: true, styleActiveLine: true, autoCloseBrackets: true, matchBrackets: true, viewportMargin: true, theme: "neo", gutters: ["CodeMirror-lint-markers"] 12 | }, 13 | $init: function(){ 14 | var self = this; 15 | for(var key in gene.options) { 16 | this._default[key] = gene.options[key]; 17 | } 18 | this._ed = CodeMirror.fromTextArea(this, this._default); 19 | this._wrapper = this._ed.getWrapperElement(); 20 | for(var key in gene.style) { 21 | this._wrapper.style[key] = gene.style[key]; 22 | } 23 | try{ 24 | this._ed.on("change", function(e){ 25 | if(self._out) self._out(self._ed.getValue()) 26 | }) 27 | } catch (e) {} 28 | if(gene.value) { 29 | self._ed.setValue(gene.value); 30 | if(self._out) { 31 | setTimeout(function(){ 32 | self._out(gene.value); 33 | },0) 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /html2json2dom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gliechtenstein/HTML2JSON2DOM/1f323cecf0b9f0bed1b93801e7a6d4ea5da4af26/html2json2dom.gif -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 34 | 35 | 36 | 37 | 92 | 93 | --------------------------------------------------------------------------------