I am trying to explain a little about how to write bbCode in one of my posts and bumped into the problem that I couldn't find any info on how to escape the square brackets so they don't get interpreted/converted by the bbCode parser.
For example, I'd like to tell them "To start a quote, first type [quote] and then type [/qoute]" (-> I misspelled the second quote deliberately in order to avoid generating a "real" quote in the post).
Is there any way to do this, without having to misspell the quotes?
(2012-08-03, 02:36 AM)brad-t Wrote: [ -> ]Put it in [ code] tags.
Then, I'd tell them "To start a quote, first type
[quote]
and then type
[/quote]
"... which looks really awful IMHO because it breaks the natural flow of reading.
That actually brings me to another question with bbCode: is there a way to do
inline code to generate something like <code>this</code> without that big
Code box? I think
stackoverflow has a really nice way of dealing with this, in that it allows the user to choose between both - inline and boxed...
...the more I think of it, it seems like I have to mess with the bbCode parser, or can I get around this with custom bbCodes? The inline code thing should be possible IMO, but for correct non-interpretation of quoted bbCode [tags]?
Another solution:
Type like this:
[b][[/b]IMG[b]][/b] [b][[/b]/IMG[b]][/b]
It will appear this way:
[IMG
] [/IMG
]
For the boxes, don't mess with parsers. Simply modify the styles of blockquote and codeblock in your global.css as per your choice.
Thanks for that idea, it is great! That also could be the basis for a custom MyCode which doesn't change the formatting (as in your case to bold) but can just be used to escape the square brackets... I'll give it a try.
Well, the sane way to explain it would be to write:
[quote]Quoted message here[/quote]
Or you can make a new mycode that wraps in <pre> tags.
(2012-08-03, 02:50 AM)FriendFX Wrote: [ -> ]That actually brings me to another question with bbCode: is there a way to do inline code to generate something like <code>this</code> without that big Code box? I think stackoverflow has a really nice way of dealing with this, in that it allows the user to choose between both - inline and boxed...
i created a custom MyCode to do this.
see here:
http://community.mybb.com/thread-133376.html
That just changes how the text is displayed. What happens if I type [c][quote]examplecode[/quote][/c]? To get it to not parse, you'd have to override the parser with either a plugin or a code edit.