MyBB Community Forums

Full Version: Change Code BB Tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Remove code and php tag.

Add code=lang tag and any code colorant. (Prism or highlight.js)

Example

For HTML (xxx = code):

[xxx=html]your code here[/xxx]

Output (Source Code)

<pre><code>your code here</code></pre>

I believe this is necessary.

Thx.
I don't really think that this is necessary or something important but ok...
I think details are important Sad
I want to say that this is not necessary for most of forums and it would be real pain to make that different for each language or so and even than not all languages will be implemented as there are too much of them so...

Maybe it's not something necessary right now.
Considering that MyBB already has support for PHP syntax highlighting, it probably won't hurt adding that for every other language. If I recall, the 2.0 parser had support for Markdown, which in Discord would be:

```php
...PHP code here...
```

Edit: I got tripped up by the names Discourse and Discord being similar again x.x
(2017-12-09, 03:18 AM)Azah Wrote: [ -> ]Considering that MyBB already has support for PHP syntax highlighting, it probably won't hurt adding that for every other language.
Actually the reason it's there is likely because PHP syntax highlighting is included in PHP itself.
Other languages would require someone to actually write a parser, which may introduce speed issues and the like.
Yeah, we could do the syntax highlighting with JS, but then when users have JS disabled obviously that won't work. Whether that's an acceptable trade-off, I'm not sure.
There is another thread about highlighting code syntax. Code is complex enough it would require a full-blown plugin / parser instead of a simple REGEX / replace custom MyCode. I don't know if enough forums post code to make code block a standard MyCode. Also, as I mentioned in that other thread, use GeSHi to highlight the syntax on the server side instead of relying on complex JavaScript.