From 10e58d5b142568e8f4b469333f68573f9494c570 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 3 Jan 2012 00:35:47 -0600 Subject: [PATCH] update readme and license --- LICENSE | 38 +++++++++++++++++++------------------- README.md | 41 ++++++++++++++++++++++++++++++++++++++--- lib/marked.js | 2 +- 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/LICENSE b/LICENSE index 5076d06a..40597477 100644 --- a/LICENSE +++ b/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2011, Christopher Jeffrey (https://github.com/chjj/) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +Copyright (c) 2011-2012, Christopher Jeffrey (https://github.com/chjj/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index 0878689f..00ef1fcc 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,42 @@ $ cat hello.html

hello world

``` -## Todo +## Syntax Highlighting -- Implement GFM features. -- Add an explicit pretty printing and minification feature. +Marked has an interface that allows for a syntax highlighter to highlight code +blocks before they're output. + +Example implementation: + +``` js +var highlight = require('my-syntax-highlighter') + , marked_ = require('marked'); + +var marked = function(text) { + var tokens = marked_.lexer(text) + , l = tokens.length + , i = 0 + , token; + + for (; i < l; i++) { + token = tokens[i]; + if (token.type === 'code') { + token.text = highlight(token.text, token.lang); + // marked should not escape this + token.escaped = true; + } + } + + text = marked_.parser(tokens); + + return text; +}; + +module.exports = marked; +``` + +## License + +Copyright (c) 2011-2012, Christopher Jeffrey. (MIT License) + +See LICENSE for more info. diff --git a/lib/marked.js b/lib/marked.js index 75bf3280..eb9415e9 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -1,6 +1,6 @@ /** * marked - A markdown parser (https://github.com/chjj/marked) - * Copyright (c) 2011, Christopher Jeffrey. (MIT Licensed) + * Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed) */ ;(function() {