Colourised bbcode in a text editor

Helpful Hints for Both the Technical and Roleplaying Aspects of the Game

Moderators: Moderator, DM

User avatar
Deathgrowl
Recognized Donor
Posts: 6592
Joined: Thu Oct 20, 2011 6:10 pm
Location: VIKING NORWAY!
Contact:

Colourised bbcode in a text editor

Unread post by Deathgrowl »

When I write long things for the forums with a lot of styling or other reasons for bbcode tags, I use a text editor called Kate made by KDE. This works in Windows, Linux and MacOS.

To make the editing more readable, I have a tool that highlights and colourises the actual code, making it clearly separate from the text. For example, here is what it looks like in the file of the biography of my gnome character Uranhed:
Image


I figured I might offer this to others making such posts as well. You can download Kate itself from the link above, and then install it as normal.

Make sure to start and close Kate once to set up all the paths.

Then you need this XML-file:
bbcode.xml

This needs to be placed in the following folder (make the folder if it doesn't exist):
  • Linux: ~/.local/share/org.kde.syntax-highlighting/syntax/
  • Windows: %localappdata%\org.kde.syntax-highlighting\syntax\

I don't use MacOS, so I'm not 100% sure where it goes there, but given that MacOS is a UNIX-based system, it isn't entirely out of the question that it's in the same path as in Linux.

Then start Kate, make a new document (or open an existing one) and go here:
Image



Now your bbcode should be colourised the same way as mine. It won't colourise absolutely every tag, as I haven't added all the custom ones we have, but it's easy to add more tags to the XML.

You can also open the bbcode.xml and change the colour hexcodes if you want different colours on these lines:

Code: Select all

      <itemData name="Tag" defStyleNum="dsKeyword" color="#00ff88" bold="true"/>
      <itemData name="Attribute" defStyleNum="dsString" color="#ffcc00"/>
As an aside, Kate has a lot of other utilities I use, like Replace All (say you want to replace all color=#ff0000 with color=#0000ff, for example, or Find In All Open Documents (like some people use Textcrawler) to scour through logs for example.
Laitae Lafreth, became Chosen of Mystra, former Great Reader of Candlekeep
Nëa the Little Shadow
Uranhed Jandinwed, Guide of Candlekeep

Free music:
http://soundcloud.com/progressionmusic/sets/luna
Post Reply

Return to “Tips & Tricks”