From 59e767832c33d30347244349aa0338d2a8c6c39a Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Sun, 7 Feb 2016 01:24:27 -0800 Subject: [PATCH] Renames `html-renderer` to `syntaxhighlighter-html-renderer`. --- README.md | 17 ++++++++++++----- html-renderer.js => index.js | 4 +--- package.json | 13 +++++++------ test.js | 15 +++++++-------- 4 files changed, 27 insertions(+), 22 deletions(-) rename html-renderer.js => index.js (99%) diff --git a/README.md b/README.md index c2db6fb..b4bbc6f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,23 @@ -# syntaxhighlighter/html-renderer +# syntaxhighlighter-html-renderer -HTML renderer module for [SyntaxHighlighter](https://github.com/syntaxhighlighter/syntaxhighlighter). It takes in the source, list of processed matches and returns HTML string. +[![GratiPay](https://img.shields.io/gratipay/user/alexgorbatchev.svg)](https://gratipay.com/alexgorbatchev/) +[![Build Status](https://travis-ci.org/syntaxhighlighter/syntaxhighlighter-html-renderer.svg)](https://travis-ci.org/syntaxhighlighter/syntaxhighlighter-html-renderer) +![Downloads](https://img.shields.io/npm/dm/syntaxhighlighter-html-renderer.svg) +![Version](https://img.shields.io/npm/v/syntaxhighlighter-html-renderer.svg) -[![Build Status](https://travis-ci.org/syntaxhighlighter/html-renderer.svg)](https://travis-ci.org/syntaxhighlighter/html-renderer) +HTML renderer module for [SyntaxHighlighter](https://github.com/syntaxhighlighter/syntaxhighlighter). It takes in the source, list of processed matches and returns HTML string. ## Installation - npm install html-renderer +``` +npm install html-renderer +``` ## Testing - npm test +``` +npm test +``` ## License diff --git a/html-renderer.js b/index.js similarity index 99% rename from html-renderer.js rename to index.js index e94a423..9637759 100644 --- a/html-renderer.js +++ b/index.js @@ -39,7 +39,7 @@ function getLinesToHighlight(opts) return results; } -function Renderer(code, matches, opts) +export default function Renderer(code, matches, opts) { var _this = this; @@ -388,5 +388,3 @@ Renderer.prototype = { return html; }, }; - -module.exports = Renderer; diff --git a/package.json b/package.json index a68ddd4..bf9d453 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,23 @@ { - "name": "html-renderer", + "name": "syntaxhighlighter-html-renderer", "version": "4.0.0", "description": "HTML renderer module for SyntaxHighlighter.", "keywords": [ "syntaxhighlighter", "html", - "renderer" + "renderer", + "core" ], - "homepage": "https://github.com/syntaxhighlighter/html-renderer", - "bugs": "https://github.com/syntaxhighlighter/html-renderer/issues", + "homepage": "https://github.com/syntaxhighlighter/syntaxhighlighter-html-renderer", + "bugs": "https://github.com/syntaxhighlighter/syntaxhighlighter-html-renderer/issues", "author": { "name": "Alex Gorbatchev", "url": "https://github.com/alexgorbatchev" }, - "main": "./html-renderer.js", + "main": "./index.js", "repository": { "type": "git", - "url": "https://github.com/syntaxhighlighter/html-renderer.git" + "url": "https://github.com/syntaxhighlighter/syntaxhighlighter-html-renderer.git" }, "scripts": { "test": "mocha --opts mocha.opts test.js" diff --git a/test.js b/test.js index 5c28c71..c614fe2 100644 --- a/test.js +++ b/test.js @@ -1,9 +1,8 @@ -const $ = require('cheerio'); -const chai = require('chai'); -const fs = require('fs'); -const match = require('syntaxhighlighter-match'); -const Renderer = require('./html-renderer'); -const expect = chai.expect; +import $ from 'cheerio'; +import { expect } from 'chai'; +import fs from 'fs'; +import { applyRegexList } from 'syntaxhighlighter-match'; +import Renderer from '.'; const REGEX_LIST = [ {regex: /hello|world/g, css: 'greeting'}, @@ -13,12 +12,12 @@ const REGEX_LIST = [ const CODE = fs.readFileSync(`${__dirname}/fixture.js`, 'utf8'); function getHtml(code, opts = {}) { - const matches = match.applyRegexList(code, opts.regexList || REGEX_LIST); + const matches = applyRegexList(code, opts.regexList || REGEX_LIST); const renderer = new Renderer(code, matches, opts); return renderer.getHtml(); } -describe('html-renderer', function() { +describe('syntaxhighlighter-html-renderer', function() { let element = null; function itHasElements({gutter, lineCount, firstLine = 1, highlight = []} = {}) {