Checking BBCode with Notepad++

Help finding those pesky BBCode issues

What is Notepad++? It's a free text editor built for writing and editing code. So it's perfect for the job!
 
What if I don't know anything about BBCode? Please the 'WORLD ANVIL TAGS REFERENCE' at the bottom of any article or see the Codex for commands available and formatting .
 
How hard is this going to be? Your world-building time is precious! This won't take long. Just know that BBCode isn't standardized and WA has its own flavor of BBCode, so we have to define a new (programming) language for Notepad++. For BBCode, this is easy! Promise! It's just a few steps.
 

How to define a language for BBCode checking in Notepad++

Step 1 If you don't have it already, download and install Notepad++.
 
Step 2 In Notepad++, go to Language->Define Your Own Language. Then click on the Operators & Delimiters tab.
 
Step 3 In the Delimiter style 1 'Open' field add
[
Then in the Delimiter style 1 'Close' field add
]

Delimeter 1 options
 
Step 4 Click on the Delimiter style 1 'Styler' button. Under Font Options, click on the 'Foreground color' box to choose a color you like. And check the boxes for nesting delimiters 1 and 2. It's also recommended clicking the boxes for 'bold' and 'italic'.
Notepad++ delimeter 1 styling

Then click 'Ok'.
 
Step 5 In the Delimiter style 2 'Open' field add
@[
Then in the Delimiter style 2 'Close' field add
]

Delimeter 2 - Notepad++
 
Step 6 Click on the Delimiter style 2 'Styler' button. Under Font Options, click on the 'Foreground color' box to choose a color you like - that is different from Delimiter 1's color. And check the boxes for nesting delimiters 1 and 2. It's also recommended clicking the boxes for 'bold' and 'italic'.
notepad++ delimeter 2 styling

Then click 'Ok'.
 
Step 7 Now you'll want to save it. Click Save As on the same screen, and give it a meaningful name like WA BBCode and click 'Ok'. Then close the popup window.
 
Step 8 Restart Notepad++ and the WA BBCode should show up under Languages at the bottom.
 

How To Use the WA BBCode 'language'

Put the BBcode in Notepad++ When you have your BBCode pasted/loaded into Notepad++, click on Languages and choose WA BBCode (or whatever you named it).
Choose WA BBcode as language
 
To check your tags
  • Scan through your code in the Notepad++ window. Is there anything that should be the color you chose for your tags, that isn't the right color?
  • Double-click on the name of a tag. All tags with that name will now be highlighted. Check those to make sure each tag that should have a matching closing tag (one with a / in it) has one. (Common culprits are li, ul, tr, td, left, right, center, justify, row, and col.)
 
An example Here's a snippet of code borrowed from the Codex pages. But there's a problem. Can you see that there isn't a closing [/li] tag in the 4th line down? (line #28 in the editor)
Unclosed tags.jpg
  See: Checking BBCode with Notepad++ (Advanced Usage) for more tricks.

Credits Kummer Wolfe on the WA discord had a great suggestion to use Notepad++ to color-code BBCode tags and we hashed it out together for the information needed for this article.
 
Why doesn't Notepad++ just have BBCode listed as a language? The problem is, that because BBCode isn't standardized and WA has its own flavor of BBCode, we have to define a new (programming) language for our text editor.
 
Why not just share a .XML file to import? I thought about it. But what if people would like to tweak it for their own tastes and purposes? Then they'd have to figure out everything that KW and I did and re-invent the wheel. So, we might as well get you started on how to customize it from the get-go.

Updates

9/8/2019 Thanks to Vlad for letting me know the original wouldn't catch @[ and ] mistakes. Corrected.
11/11/2019 Corrected a spelling mistake.

Comments

Please Login in order to comment!
21 Sep, 2019 09:56

Excellent guide, thank you for this! I'm just checking out the advanced guide now!

Creator of the dark fantasy world of Melior
21 Sep, 2019 16:52

Thank you! Hope it's of help to you!

Author of the upcoming book Rise: Liminal Chronicles |
Powered by World Anvil