Skip to content

Commit 04e66f4

Browse files
chibicodewooorm
authored andcommitted
Update dependencies
Update highlightjs to include at least 9.3.0, which contained some changes which were incorporated in lowlight’s core. The new `skip` option (highlightjs/highlight.js@517d2da) is not yet included. Closes GH-1.
1 parent eca00b6 commit 04e66f4

File tree

7 files changed

+25
-51
lines changed

7 files changed

+25
-51
lines changed

lib/core.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function compileLanguage(language) {
202202
mode.keywords = compiledKeywords;
203203
}
204204

205-
mode.lexemesRe = langRe(mode.lexemes || /\b\w+\b/, true);
205+
mode.lexemesRe = langRe(mode.lexemes || /\w+/, true);
206206

207207
if (parent) {
208208
if (mode.beginKeywords) {
@@ -355,6 +355,7 @@ function coreHighlight(name, value, ignore, prefix, continuation) {
355355
* @private
356356
*/
357357
function pop() {
358+
/* istanbul ignore next - removed in hljs 9.3 */
358359
currentChildren = stack.pop() || children;
359360
}
360361

@@ -617,9 +618,13 @@ function coreHighlight(name, value, ignore, prefix, continuation) {
617618
* @return {string} - The processed buffer.
618619
*/
619620
function processBuffer() {
620-
return top.subLanguage !== undefined ?
621+
var result = top.subLanguage !== undefined ?
621622
processSubLanguage() :
622623
processKeywords();
624+
625+
modeBuffer = EMPTY;
626+
627+
return result;
623628
}
624629

625630
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"bugs": "https://github.com/wooorm/lowlight/issues",
2424
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
2525
"dependencies": {
26-
"highlight.js": "^9.1.0"
26+
"highlight.js": "^9.3.0"
2727
},
2828
"devDependencies": {
2929
"browserify": "^13.0.0",

test/fixture/http-default/output.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
<span class="hljs-attribute">Content-Type</span>: application/json; charset=utf-8
44
<span class="hljs-attribute">Content-Length</span>: 19
55

6-
<span class="json">{"<span class="hljs-attr">status</span>": <span class="hljs-string">"ok"</span>, "<span class="hljs-attr">extended</span>": <span class="hljs-literal">true</span>}
7-
</span>
6+
<span class="json">{<span class="hljs-attr">"status"</span>: <span class="hljs-string">"ok"</span>, <span class="hljs-attr">"extended"</span>: <span class="hljs-literal">true</span>}</span>

test/fixture/js-jsx/input.txt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
var X = React.createClass({
2-
render: function() {
3-
var c = this.map(c => <Comment comment={c} key={c.id} />);
4-
return (
5-
<div className='comments'>
6-
{c}
7-
</div>
8-
);
9-
},
10-
foo: function() {}
11-
});
12-
13-
var Comment = React.createClass({
14-
render: function() {
15-
var comment = this.props.comment;
16-
return (
17-
<li>{comment}</li>
18-
);
19-
}
20-
foo: function() {}
21-
});
1+
var jsx = <node/>;
2+
var jsx = <node><child/></node>;
3+
var jsx = <node>...<child>...</child></node>;
4+
var jsx = <div><br /></div>;
5+
var x = 5;
6+
return (<node attr="value"></node>);

test/fixture/js-jsx/output.txt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
<span class="hljs-keyword">var</span> X = React.createClass({
2-
render: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
3-
<span class="hljs-keyword">var</span> c = <span class="hljs-keyword">this</span>.map(c =&gt; <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Comment</span> <span class="hljs-attr">comment</span>=<span class="hljs-string">{c}</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{c.id}</span> /&gt;</span>)</span>;
4-
<span class="hljs-keyword">return</span> (
5-
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">className</span>=<span class="hljs-string">'comments'</span>&gt;</span>
6-
{c}
7-
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
8-
)</span>;
9-
},
10-
foo: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{}
11-
});
12-
13-
<span class="hljs-keyword">var</span> Comment = React.createClass({
14-
render: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
15-
<span class="hljs-keyword">var</span> comment = <span class="hljs-keyword">this</span>.props.comment;
16-
<span class="hljs-keyword">return</span> (
17-
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>{comment}<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
18-
)</span>;
19-
}
20-
foo: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{}
21-
});
1+
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span>/&gt;</span></span>;
2+
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span>&gt;</span></span>&lt;child/&gt;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">node</span>&gt;</span></span>;
3+
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span>&gt;</span>...</span>&lt;child&gt;...&lt;/child&gt;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">node</span>&gt;</span></span>;
4+
<span class="hljs-keyword">var</span> jsx = <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span></span>&lt;br /&gt;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>;
5+
<span class="hljs-keyword">var</span> x = <span class="hljs-number">5</span>;
6+
<span class="hljs-keyword">return</span> (<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">node</span> <span class="hljs-attr">attr</span>=<span class="hljs-string">&quot;value&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">node</span>&gt;</span></span>);

test/fixture/xml-large/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<span class="hljs-meta">&lt;?xml version="1.0"?&gt;</span>
1+
<span class="php"><span class="hljs-meta">&lt;?</span>xml version=<span class="hljs-string">"1.0"</span><span class="hljs-meta">?&gt;</span></span>
22
<span class="hljs-tag">&lt;<span class="hljs-name">response</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"ok"</span> <span class="hljs-attr">xml:lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
33
<span class="hljs-tag">&lt;<span class="hljs-name">text</span>&gt;</span>Ok<span class="hljs-tag">&lt;/<span class="hljs-name">text</span>&gt;</span>
44
<span class="hljs-tag">&lt;<span class="hljs-name">comment</span> <span class="hljs-attr">html_allowed</span>=<span class="hljs-string">"true"</span>/&gt;</span>

test/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ test('lowlight(value[, options])', function (t) {
313313

314314
st.equal(
315315
result.secondBest.language,
316-
'hsp',
316+
'mipsasm',
317317
'should return a `secondBest` `language`'
318318
);
319319

@@ -424,8 +424,8 @@ test('fixtures', function (t) {
424424
* @param {string} directory - File path to directory.
425425
*/
426426
function subtest(language, name, directory) {
427-
var input = read(join(FIXTURES, directory, INPUT), 'utf8');
428-
var output = read(join(FIXTURES, directory, OUTPUT), 'utf8');
427+
var input = read(join(FIXTURES, directory, INPUT), 'utf8').trim();
428+
var output = read(join(FIXTURES, directory, OUTPUT), 'utf8').trim();
429429

430430
input = low.highlight(language, input);
431431
output = hast.parse(output);

0 commit comments

Comments
 (0)