Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions library.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
function getSetString(match, src, width, height) {

if (width === "" && height === "") {

return match;
}

return "<img src=\"" + src + "\" width=\"" + width + "\" height=\"" + height + "\"" + " style=\"height:" + height + "px;\"";
return `<img src="${src}" style="width:${width}px!important; height:${height}px!important;"`;
}

function getPercentString(match, src, percent) {
return "<img src=\"" + src + "\" width=\"" + percent + "%\"" + " height=\"" + 'auto' + "\"";
return `<img src="${src}" style="width:${percent}%!important; height: auto!important;"`;
}

function getWidthString(match, src, width) {

if (width === "") {

return match;
}

return "<img src=\"" + src + "\" width=\"" + width + "\" height=\"" + 'auto' + "\"";
return `<img src="${src}" style="width: ${width}px!important; height: auto!important;"`;
}

function replaceContent(data) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "nodebb-plugin-image-md-size",
"version": "0.9.0",
"name": "@nodebb/nodebb-plugin-image-md-size",
"version": "0.9.1",
"description": "NodeBB plugin which allows you to change the size of a markdown image in a post using the @ character.",
"main": "library.js",
"repository": {
"type": "git",
"url": "https://github.com/MilWolf/nodebb-plugin-image-md-size"
"url": "https://github.com/NodeBB-Community/nodebb-plugin-image-md-size"
},
"keywords": [
"nodebb",
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"readmeFilename": "README.md",
"nbbpm": {
"compatibility": ">=0.6.0 <=1.18.0"
"compatibility": ">=1.0.0 <5.0.0"
},
"devDependencies": {
"@commitlint/cli": "13.1.0",
Expand Down
2 changes: 0 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"id": "nodebb-plugin-image-md-size",
"url": "nodebb-plugin-image-md-size",
"library": "./library.js",
"hooks": [
{"hook": "filter:parse.post", "method": "sizeImages"},
Expand Down