asciidoctor-prism-extension
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -28,3 +28,3 @@ 'use strict'; | ||
const getDocumentLanguages = (document) => { | ||
return document.getAttribute('prism-languages', DEFAULT_LANGUAGES) | ||
return (document.getAttribute('prism-languages') || DEFAULT_LANGUAGES) | ||
.split(',') | ||
@@ -45,4 +45,5 @@ .map(lang => lang.trim()); | ||
loadLanguages(languages); | ||
this.backend = backend; | ||
this.theme = document.getAttribute('prism-theme'); | ||
this.theme = document.hasAttribute('prism-theme') ? document.getAttribute('prism-theme') || DEFAULT_THEME : null; | ||
this.languages = languages; | ||
@@ -84,5 +85,5 @@ | ||
const theme = this.theme || DEFAULT_THEME; | ||
const {theme} = this; | ||
if (!this.theme || !theme) { | ||
if (!theme) { | ||
return ''; | ||
@@ -89,0 +90,0 @@ } |
{ | ||
"name": "asciidoctor-prism-extension", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Highlight Asciidoc code listings with Prism.js, server side, with no front-end dependencies.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
11
test.js
@@ -75,2 +75,11 @@ 'use strict'; | ||
assert.doesNotThrow(() => asciidoctor.convert(doc, options)) | ||
assert.doesNotThrow(() => asciidoctor.convert(doc, options)); | ||
// Default theme works | ||
var attributes = [ | ||
'prism-theme', | ||
'source-highlighter=prism', | ||
]; | ||
var options = {attributes, backend, header_footer: true, safe: 'server'}; | ||
var output = asciidoctor.convert(doc, options); | ||
assert.ok(output.match('<style type="text/css" class="prism-theme">')); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44340
140