NodeBB Plugin for macros, format, embeding.
npm install nodebb-plugin-magicblockNodeBB Plugin for macros, format, embeding.
* Discussion and examples at NodeBB Forum
{{..}} without modifications of the iframely plugin.
{{ Any Link }}
{{ http://imgur.com/gallery/BxHKr }}
`
!Imgur gallery
* If you put any link in MagicBlock then MagicBlock will take care How show it With full customization.
* image, imgur gallery are built in, and you can add more or override them.
Support iFramely*( Enable iFramely only in {{..}} ) We have three options.
* Option 1) With modified iframely plugin
* set magicTagADefaultClass: [ iframely ] in MagicBlock admin UI
* remove original iframely plugin
* install the modified iframely plugin manualy from github.
* set iframely Class to iframely in modified iframely admin UI
* Option 2) Client side load : this doesn't implemented yet until somebody wants :)
* Option 3) With an official iframely plugin. ( RECOMENDED )
* set hackIframely: true in YAML. ( Of course, you need nodebb-plugin-iframely installed )
* That's it.$3
{{.class1.class2#color1#color2 BODY }}
* When a block begins with AttrString( begin with . or # and before a first white space )#### Coloring
* A first color is for forground , a second is for backgoround color.
* Also rgb codes are possible. ( #eee or #e1e1e1 )
`
{{#red This is red letters}}
{{#red#green This is red letters on green background}}
`
!Coloring#### Class
`
{{.class1 link}} will become link
`
* YES, class can make things messy, may be too much, usually useless BUT it's disabled by default. Solved!! :)#### Wraping with
or
* : If an AttrString is ended with double colons (::), followed text will be wraped by
* : If an AttrString is ended with a colon (:), followed text will be wraped by
* These are usually too much also, just turn it off !! ( by default )
`
{{.cls1#red:: Any text or link}} will become Any text or link
{{.cls1#red: Any text or link}} will become Any text or link
`
* Implicit way : If no colon(s) end of an AttrString
* If begins of BODY is any html tag, MagicBlock insert classes and colors into it
* NOTE : MagicBlock knows nothing of Markdown, but just manage htmls which are already converted by MarkdownIt.
* With {{ link }}, what actually MagicBlock will see is {{ link }}
* With {{ http://a.com }}, what actually MagicBlock will see is {{ a.com}}
* If begins of BODY is not a html tag, MagicBlock will wrap BODY with
`
{{.cls1#red !txt}} will become 
{{.cls1#red text}} will become text
`
#### And,,
* Except #color, this AttrString can easily be too much. Recently I played wiki engins and I may be infected by wiki syntax and macros. Actually, I also plan to split magicblock as a standalone module from the nodeBB plugin, and they will be useful in other project ( At least for mine ).$3
* A forum admin can add custom macros via admin UI
* examples ( built in )
`
{{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 }}
`
!Macros$3
MagicBlock also support nested blocks. Always innder block will be manipulated first.
`
{{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
`Configuratoin
Currently single YAML string is only supported.
* In macros, a number in (..) means number of arguments. Arguments will replace each <<1>> <<2>>.
* BODY of block will replace <>
* Currently, only tag can go thourgh magic. Others will come later ( but what will be useful after and ? )
* If you don't want macros or magicTagA then just false will be better then empty array or dictionary
* macros: false
$3
`
---
attrStrAllowClass: false
attrStrAllowColor: true
attrStrAllowColon: false
attrStrAllowTwoColon: false
macros:
br(0): '
'
ALERT(1): '<>'
ALERT(0): '<>'
PANEL(1): '<>'
PANEL(2): '<<2>><>'
magicTagA:
- [ '.*(jpg|png|gif|svg)$' , true , '
' ]
- - '^(?:http:)?//imgur.com/(?:a|gallery)/(\w+)'
- true
- 'View post on imgur.com
'
magicTagADefaultClass: [ iframely ]
hackIframely: false
``