Skip to content
Snippets Groups Projects
Verified Commit 6d62264a authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Allow to disable lightbox for certain images

Just write ![alt](img.png =x123,nolightbox)
or ![alt](img.png =nolightbox)

Also fixed tables being too big
parent c69cb7ba
No related branches found
No related tags found
No related merge requests found
'use strict';
/*
* Transforms pages[0..length].content from markdown to HTML
*/
......@@ -45,13 +46,25 @@ module.exports = function(obj) {
renderer.image = function(href, title, text) {
href = href.split(path.sep).join('/');
href = href.split(' =');
var size = href[1];
var params = href[1];
var options = {};
if(params) {
for(let param of params.split(',')) {
param = param.trim();
// 123x or x123 or 123x123
if(param.match(/[0-9]*x[0-9]+/) || param.match(/[0-9]+x[0-9]*/)) {
options.size = param.split('x');
} else if(param == 'nolightbox') {
options.nolightbox = true;
}
}
}
href = href[0];
var rel = path.relative(process.cwd(),path.resolve(article.filename,href));
var out = '<img src="' + href + '" alt="' + text + '"';
if(size !== undefined) {
size = size.split('x');
if(options.size !== undefined) {
var size = options.size;
if(size[0].length > 0) {
out += ' width="' + size[0] + '"';
}
......@@ -64,7 +77,7 @@ module.exports = function(obj) {
}
out += '>';
if(true) { // if lightbox
if(!options.nolightbox) { // if lightbox
var full = href;
var a = '<a href="'+full+'"';
a += ' data-lightbox="group"';
......
......@@ -222,6 +222,11 @@ nav.subnav li {
max-width: $p-max-width;
margin: 0 auto;
}
table {
max-width: $p-max-width;
padding: .5rem 0rem;
margin: 0 auto;
}
h2#title {
margin: 0px;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment