Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith-metallic

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-metallic - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

test/fixture/build/nohighlight.md

13

lib/index.js

@@ -5,2 +5,3 @@

var hljs = require('highlight.js');
var entities = require("entities");

@@ -32,3 +33,3 @@ /**

var end = /```/;
var typed = /```(\w+)\r?\n/;
var typed = /```([\w\-]+)\r?\n/;
var remainder = str;

@@ -66,8 +67,12 @@ var pos = 0;

if (lang==null) {
replacements.push("<code>"+hljs.highlightAuto(code).value+"</code>");
replacements.push("<pre><code>"+hljs.highlightAuto(code).value+"</code></pre>");
} else {
try {
replacements.push("<code>"+hljs.highlight(lang, code).value+"</code>");
if (lang==="no-highlight") {
replacements.push("<pre><code class=\""+lang+"\">"+entities.encodeHTML(code)+"</code></pre>");
} else {
replacements.push("<pre><code class=\""+lang+"\">"+hljs.highlight(lang, code).value+"</code></pre>");
}
} catch(err) {
replacements.push("<code>"+hljs.highlightAuto(code).value+"</code>");
replacements.push("<pre><code>"+hljs.highlightAuto(code).value+"</code></pre>");
}

@@ -74,0 +79,0 @@ }

@@ -5,8 +5,12 @@ {

"repository": "git://github.com/weswigham/metalsmith-metallic.git",
"version": "0.1.1",
"version": "0.2.0",
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"test": "mocha"
},
"dependencies": {
"debug": "~0.7.4",
"highlight.js": "~8.0.0"
"highlight.js": "~8.1",
"entities": "~1.1"
},

@@ -13,0 +17,0 @@ "devDependencies": {

Non code
<code><span class="hljs-built_in">local</span> <span class="hljs-built_in">var</span> <span class="hljs-subst">=</span> <span class="hljs-string">"untyped code"</span></code>
<pre><code><span class="hljs-built_in">local</span> <span class="hljs-built_in">var</span> <span class="hljs-subst">=</span> <span class="hljs-string">"untyped code"</span></code></pre>
<code><span class="hljs-keyword">var</span> t = <span class="hljs-string">'typed code'</span></code>
<pre><code class="js"><span class="hljs-keyword">var</span> t = <span class="hljs-string">'typed code'</span></code></pre>
More non code
Non code
<code><span class="hljs-built_in">local</span> <span class="hljs-built_in">var</span> <span class="hljs-subst">=</span> <span class="hljs-string">"untyped code"</span></code>
<pre><code><span class="hljs-built_in">local</span> <span class="hljs-built_in">var</span> <span class="hljs-subst">=</span> <span class="hljs-string">"untyped code"</span></code></pre>
<code><span class="hljs-keyword">var</span> t = <span class="hljs-string">'typed code'</span></code>
<pre><code class="js"><span class="hljs-keyword">var</span> t = <span class="hljs-string">'typed code'</span></code></pre>
More non code

@@ -10,15 +10,30 @@

it('should highlight code blocks in markdown files', function(done){
fs.readFile('test/fixture/expected/index.md', 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
Metalsmith('test/fixture')
.use(metallic())
.build(function(err, files){
if (err) return done(err);
assert.equal(data.toString(), files['index.md'].contents);
done();
});
fs.readFile('test/fixture/expected/index.md', 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
Metalsmith('test/fixture')
.use(metallic())
.build(function(err, files){
if (err) return done(err);
assert.equal(data.toString(), files['index.md'].contents);
done();
});
});
});
it('should parse code blocks with the no-highlight language in markdown files', function(done){
fs.readFile('test/fixture/expected/nohighlight.md', 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
Metalsmith('test/fixture')
.use(metallic())
.build(function(err, files){
if (err) return done(err);
assert.equal(data.toString(), files['nohighlight.md'].contents);
done();
});
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc