-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# markupify | ||
|
||
Highlight your JSON with html markup | ||
|
||
npm install markupify | ||
|
||
Markupify will take a JSON document and add markup to it so it can be styled in a browser. | ||
|
||
``` js | ||
var markupify = require('markupify'); | ||
|
||
var html = markupify({hello:'world'}); | ||
|
||
console.log(html); | ||
``` | ||
|
||
The above example will print the following html | ||
|
||
``` html | ||
<div class="markupify">{ | ||
<span class="key">hello:</span> <span class="string">"world"</span> | ||
}</div> | ||
``` | ||
|
||
Afterwards you can use css to style your output to your liking. | ||
A stylesheet similar to [JSON view](https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc) is included in [style.css](https://github.com/mafintosh/markupify/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name":"markupify", | ||
"version":"0.1.0", | ||
"repository": "git://github.com/mafintosh/markupify", | ||
"description":"a json to html syntax highlighter", | ||
"keywords": ["json", "html", "syntax", "highlight"], | ||
"author": "Mathias Buus Madsen <[email protected]>" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.markupify { | ||
line-height: 17px; | ||
font-size: 13px; | ||
font-family: monospace; | ||
white-space: pre; | ||
} | ||
.markupify .key { | ||
font-weight: bold; | ||
} | ||
.markupify .bool { | ||
color: firebrick; | ||
} | ||
.markupify .string { | ||
color: green; | ||
} | ||
.markupify .null { | ||
color: gray; | ||
} | ||
.markupify .number { | ||
color: blue; | ||
} |