Can BBCode translation be disabled inside a code block?

  • Suggestion
  • Thread starter PeterDonis
  • Start date
In summary, @Mark44 suggested that BBCode translation may have caused a change to Python code posted in a computer forum thread. The code was inside a [CODE] block and the lowercase i inside brackets, [i], was changed to an uppercase I, which is BBCode for starting an italics block. It is possible that this translation can be disabled within code blocks, as it is believed that BBCode is ignored in such blocks. However, it is possible that the translation occurs during post editing or in other specific situations.
  • #1
45,641
22,663
In a recent thread in the computer forum, a member posted Python code that was inadvertently changed by something in the posting process. @Mark44 suggested that it could be BBCode translation (a lower case i inside brackets, [i], which was an array reference in the code, got changed to an upper case I, and [I] is BBcode for starting an italics block). The Python code was inside a [CODE] block; would it be possible to disable BBCode translation inside code blocks?

@Mark44's post in the thread in question is here:

https://www.physicsforums.com/threads/python-code-returning-none.1012334/post-6599954
 
Physics news on Phys.org
  • #2
testing:
[i][/i]
[b][/b]
[u][/u]

I was always under impression BBCode IS ignored in the code blocks and - at least when I post from my computer - that seems to be the case.

Could be it gets processed when the post is edited or dealt with in some specific way.
 
  • #3
I've seen this happen where a bracketed i gets treated as a BBCode italics start tag. I can't reproduce this now for some reason.
 

1. Can BBCode translation be disabled for specific code blocks only?

Yes, it is possible to disable BBCode translation for specific code blocks by using the [nobbc] tag before and after the code block. This will prevent BBCode from being parsed within the code block.

2. Is it possible to disable BBCode translation for all code blocks on a webpage?

Yes, you can disable BBCode translation for all code blocks on a webpage by setting the "Allow BBCode in Code" option to "No" in the site's BBCode settings. This will prevent BBCode from being parsed within any code block on the webpage.

3. Will disabling BBCode translation affect the formatting of the code block?

No, disabling BBCode translation will not affect the formatting of the code block. The code will still be displayed as it was originally written, without any BBCode tags being parsed.

4. Can BBCode translation be disabled for specific languages within a code block?

No, BBCode translation can only be disabled for the entire code block, not for specific languages within the code block. If you want to disable BBCode translation for specific languages, you will need to separate them into different code blocks.

5. Is there a way to disable BBCode translation for code blocks on a specific page only?

Yes, you can disable BBCode translation for code blocks on a specific page only by using the [nobbc] tag around the code block on that page. This will prevent BBCode from being parsed within the code block on that specific page.

Similar threads

  • Programming and Computer Science
Replies
3
Views
313
  • Feedback and Announcements
Replies
23
Views
3K
  • Feedback and Announcements
Replies
21
Views
2K
  • Feedback and Announcements
Replies
3
Views
1K
  • Programming and Computer Science
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
744
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
15
Views
3K
Back
Top