[nodebb-plugin-magicblock] Macros, Color, Embeding
-
I think this plugin is now reasonable working, so let me introduce nodebb-plugin-magicblock officially
NodeBB MagicBlock plugin
NodeBB Plugin for macros, format, embeding.
Updates
- v0.1.8 :
hackIframely
. One can enable nodebb-plugin-iframely only in{{..}}
without modifications of the iframely plugin. ( see a npm page ) - v0.1.7 had a bug.
Links
- previous discussion at NodeBB Forum
- npm
- gihub repo : https://github.com/qgp9/nodebb-plugin-magicblock
Summary
Magic
{{ Any Link }} {{ http://i.imgur.com/HxvheyR.jpg }} {{ http://imgur.com/gallery/BxHKr }}
- image, imgur gallery are built in, and you can add more or override them.
- Control iFramely by
hackIframely: true
in YAML ( see a npm page )
Coloring
{{#red This is red letters}} {{#red#green This is red letters on green background}}
Class
{{.myclass Any Text or Link }} {{.fa.fa-fw.fa-inbox}}
Customizable Macros
{{br}} -> <br/> {{ ALERT(info): This Info Box }} {{ ALERT: This is default alert Box }} {{ PANEL(success): Body Only Panel }} {{ PANEL(warning, This is title): Panel with title }}
Nested Block
{{ALERT: These are {{#blue blue letters}} In the Alert Box}} {{ALERT: This is {{ALERT(info): an Another Alert Box}} in the Alert Box }}
Installation
npm install nodebb-plugin-magicblock
History
- current version : v.0.1.3
Acknowledge
- This plugin is initialized on nodebb-mega-colors
- Thanks to @frissdiegurke for a lot of comments and guiding.
- v0.1.8 :
-
Great
Now that it gets in shape here are a few more recommendations/notes:
- I guess the lib/defaults.js is never used and duplicates lib/magicblock/defaults.js, just a side note xD
- There are a few tools at
npm
you could use rather than creating your own utilities I preferlodash
(link), it's written for performance and consistency of usage. YourdeepCopy
/buildOptions
would get replaced by_.merge
for example. It's really not a deal to have dependencies for such matters. Plus knowing a utilities features helps a lot keeping code to necessary stuff. - I see some space for improvement here; Checking
opts.attrStrAllowColor
first would improve the code and performance. - A
.npmignore
file does not extend of a.gitignore
, you have to either fill it properly or remove it entirely (in this case npm will use the.gitignore
). You have some a bit of trash within your npm release
Glad I could help!
-
Thanks always~
@frissdiegurke said:
- I guess the lib/defaults.js is never used and duplicates lib/magicblock/defaults.js, just a side note xD
Actually I use magicblock as a sepereated module, and
lib/defaults.js
is aplugin side defaults
which can be different frommagicblock defaults
, (they are yet same but.. ). Now,buildOptions
is called twice inlibrary.js
andlib/magicblock/index.js
with different(but same)default.js
.- There are a few tools at
npm
you could use rather than creating your own utilities I preferlodash
(link), it's written for performance and consistency of usage. YourdeepCopy
/buildOptions
would get replaced by_.merge
for example. It's really not a deal to have dependencies for such matters. Plus knowing a utilities features helps a lot keeping code to necessary stuff.
Yes, after I learned
lodash
from your emoji plugin, I thought exactly same thing. Thanks twice :).- I see some space for improvement here; Checking
opts.attrStrAllowColor
first would improve the code and performance.
Eagle eye!!
- A
.npmignore
file does not extend of a.gitignore
, you have to either fill it properly or remove it entirely (in this case npm will use the.gitignore
). You have some a bit of trash within your npm release
This is really something new I have never known.
I will quickly improve 3,4 first. -
I got a question if this plugin works under v0.9.4.
But I tested/developed this my first plugin with only with v1.0.0, and have no idea about version compatibility.What I can imagine to are
- Study what changed between v0.9.4 and v1.0.0
- Install v0.9.4 and test.
- Ask volunteers who (will) test the plugin with one's v0.9.4
Could anybody give better or recommendable ideas?
-
-
@julian HI, I needed you 30 minitues ago!!
I just found out thisacpScripts
after an hours testing and debuging.
I have(had) to read that post also.
Here is a link for others ( to save server resource from searching)Actually, I have an question related with
acpScript
.
So if I want to support v0.9.4 then what is best way?- put a
admin.js
( commonly called ) to both ofacpScript
andscripts
- put it to only
scripts
and remove fromacpScript
- embed into an admin tpl of a plugin.
I guess most effective way to support both versions is 3.
Could you let me know the best way? - put a
-
@qgp9 You can embed the script into the template -- depends how comfortable you are with mixing your templates and client-side code, in terms of organisation
In order to support both, you'd have to maintain two branches in git. One for each level of support. You'd need to ensure the
nbbpm.compatibility
values are set to the appropriate values in each branch'spackage.json
, and npm publish them both (though npm will show the readme of the latest published version).nbbpm should be smart enough to figure out that different versions have different compatibilities and adjust its records accordingly. If not, let me know,.
-
Hi , All
I'm testing the plugin with v0.9.4 on Cloud9.
If you are interested on this, you can post/test freely without login.
https://nodebb-0-9-4-magicblock-qgp9.c9users.io/topic/2It seems that [email protected] works well with [email protected]
-
-
Nice job!