A list of puns related to "BBCode"
Suppose I want to display the text β[a][b][c]β in a RichTextLabel with BBCode enabled.
Godot interprets the β[b]β as an opening bold tag, and displays β[a][c]β, and assumes I forgot to close it.
How do I display literal square brackets in a RichTextLabel?
Hi all,
I'm new to Swift (I really like it!) and have a best-practice question.
I have a (sometimes huge) String containing text and BBCode. I want to display said text in a SwiftUI-View. What would be the best practice approach to parse the BBCode (for example, replace [b]Text[/b] with Text)? What kind of data structure is advisable? Are AttributedStrings the way to go?
Thanks!
I have a workaround to this issue, but I am going to leave the Help flair up for another day or two because I'd love a more elegant solution. It seems like the only way to accomplish what I want is to add the messages with bbcode formatting into a ChatHistory array. When the use wants to resize ChatText font, I run ChatText.clear(), change the font, then iterate through ChatHistory, re-appending all the bbcode messages. It's ugly, but it works.
func addChat(message):
ChatText.append_bbcode(message)
Global.ChatHistory.append(message)
func _on_SpinBox_value_changed(value):
### See code below for font size change
### Workaround:
ChatText.clear()
for i in Global.ChatHistory:
ChatText.append_bbcode(i)
I'm having a ton of trouble trying to save the contents of a RichTextLabel's bbcode. The way this is being used is the RichText is essentially a chat window. Normal messages have no bbcode added, Direct Messages get surrounded by [b][/b], system messages by [i][/i], and then they are appended to the label using bbcode_append(). I have a request from a user to allow them to resize the chat font, which is why I am where I am now.
Because the font for bbcode appears to be locked in the time it is first printed, I need to be able to save the contents of bbcode_text, change the font size, then re-enter the contents back into bbcode_text. My existing code looks like this:
###Example of how messages are added to the field
ChatText.append_bbcode("[b]" + playerName + ": " + chatMessage + "[/b]\n")
###Function for changing font size
func _on_SpinBox_value_changed(value):
var regularFont = DynamicFont.new()
regularFont.font_data = load("res://Themes/Fonts/OpenSans-Regular.ttf")
var boldFont = DynamicFont.new()
boldFont.font_data = load("res://Themes/Fonts/OpenSans-Bold.ttf")
var italicFont = DynamicFont.new()
italicFont.font_data = load("res://Themes/Fonts/OpenSans-Italic.ttf")
regularFont.size = value
boldFont.size = value
italicFont.size = value
ChatText.add_font_override("normal_font", regularFont)
ChatText.add_font_override("bold_font", boldFont)
ChatText.add_font_override("italics_font", italicFont)
####First attempt was this
ChatText.set_bbcode(ChatText.get_bbcode())
####Second attempt was this
var text = ChatText.
... keep reading on reddit β‘Essentially any site or platform where you can make an account and then publish editable text - can be similar to Pastebin, except obv with formatting capabilities (incl. colors).
I've already got a good chunk of text in BBCode (from writing a forum post), so one that uses BBCode would be particularly cool; heard things about the "SCEditor" which apparently also implements BBCode in some way, though don't know much else about it as of now.
(Also an already built-in Darkmode would be cool - my current browsers seem to be inconsistent with their own darkmode, not working for old.reddit for instance.)
Does anyone know such a place?
Edit: Solved. made a global function for twig with below lib's functions.
Solution: https://pastebin.com/mrf3hJdQ
Hi.
Is there an existing way to implement bbcodes into twig (stand alone if that changes something) ?
I found this lib:
https://github.com/jbowens/jBBCode
From what i understand i have 2 paths: define at least 2 global methods ( parse and getAsHtml) or to write a bridge extension.
I don't want to do either of them.
I don't believeI'm the first one to spin his head around this, but can't find a thing in searches
Please advise.
Edit: to sum up: i want bbcode functionallyity ([b], [i]) in my templates, more clearly on some user inputs (like a chat message).
Thanks.
Variables cannot currently be used in interactive tables, as far as I am able to tell, nor does the feature appear to be listed in the roadmap. This is frustrating, because variables have the potential to simplify and streamline a variety of tasks, and tables seem an ideal place to use them. One might want a table of cities with their populations, altitudes, persons of interest, etc. Or a creator might want to have a table of players with a variety of statistics to sort by, like a leaderboard. The possibilities are - or would be - limitless.
Since variables can be used anywhere BBCode can be used (according to the Codex), allowing BBCode to be used in tables would solve the issue by default.
BBCode is useful in a variety of ways. There was a previous request for allowing font-size control in tables that would be fulfilled (at least to some extent) by this feature, and I am sure that creators would love the ability to utilize their usual styles in long-text cells of a table. Assuming that inline article creation would be allowed as it is when using BBCode in an article, this feature could also allow a creator to very quickly and efficiently add new articles to a table, rather than having to stop, create a new article, and then include it. I believe that allowing BBCode in tables will not only improve tables in their current usage, but provide myriad other purposes that a table could fulfill.
The title is probably not the easiest to understand so I'll try to explain:
I have an array like so;
export var z {
x = "text"
y = "text2"
}
I am then setting a RichTextLabel's bbcode to 'x'. Eg:
$RichTextLabel.bbcode_text += z.x
So, when I try to add a color to the text of 'x' like this;
export var z {
x = "[color=blue]text[/color]"
y = "text2"
}
Nothing happens. How can I get around this?
Edit: I managed to get it working, turns out that setting color to a defined color such as 'blue' or 'red' doesn't work. However, something such as;
export var z {
x = "[color=#a5bfdb]text[/color]"
y = "text2"
}
seems to work fine. Don't know why this is a problem, but oh well. I hope this helps someone :)
Hi, maybe this is a weird question, but is there a way to make a custom bbcode that changes a variable?
I'm working on a dialog system and it would be very helpful to change the text speed dynamically with bbcode.
Something like "So...[pause] How are you?"
Hello. I'm running a small forum website, and I'm trying to make certain posted links open in a new tab in the browser. I have added this code to my website:
https://www.phpbb.com/customise/db/bbcode/open_link_in_new_tab/
which makes me able to make simple links open in a new tab. However I also have links with a thumbnail included on my website which look like this:
[URL=https: //google. com][IMG]https: //img168.imagetwist. com/th/4738/0grf8yel9xvj.jpg[/IMG][/URL]
The code does not work for them. I'm wondering if there's anything i can modify to make it work on this types of links as well.
This is a feature discussion thread for the feature suggestion regarding adding Subscriber/Not Subscriber BBcode userstate tags
Suggestion link:https://www.worldanvil.com/community/voting/suggestion/3e36c052-beaa-4059-9067-331a3f0be921/view
Okay, so I was wandering around on World Anvil, as one does, when I happened upon a really cool article, both content-wise and aesthetically.
The article basically had the illusion of a sidebar with content areas, little info itβd-bits, etc. Then, at the very end abandoned it altogether. As a newbie to even CSS this looked super cool to me, and I wondered if this could be replicated in BBCode?
Could one have what looks to be a regular templates article, except you make the βsidebarβ and can ditch it later as one pleases? In another sense, have a 75%/25% article layout (75% = regular page content, 25% is this false sidebar) and then go full generic wide 100% article layout in the same page using BBCode?
Please let me know if this is confusing, :DβI am happy to elaborate~.
what bb code is this like that border box? does anyone know what is it ?
https://preview.redd.it/skru8htbon351.png?width=926&format=png&auto=webp&s=d466d61ef4e0d54c4f570d50f971b8dae217fc26
I'm building a reddit clone with node. Currently when users post posts and comments the only formatting that I am doing is converting newlines to HTML br tags. Now I want to make it so that users can post source code.
What's the best way to allow users to add source code to their posts and comments?
I think reddit does something with lines starting with spaces. But should I wrap each line in its own HTML pre tag or should I wrap all lines that are together in a single pre tag?
Or maybe lines starting with spaces isn't the best approach. Maybe just have some sort of coding tag that users wrap around their code so they don't have to deal with the spaces.
What do you think? What's your preference?
Hi everyone,
only a couple of numbers and one comma can be entered into my RichTextLabel. It's bbcoded quite a bit (align right, change color at a certain number of digits, some offset for the first digit and such things...). There are several different bbcode-templates kicking in on different occasions.
Now I want that comma to have an extra offset, so I wonder if it's possible to apply bbcode to an already bbcoded text, as "layering another bbcode on top", or "have two bbcodes running on the same thing simultaneously". Because adding some extra comma-offset into each of the templates seems unpractical to me.
I'm thinking about something like
var templateCommaHigher = "[offset x=0 y=15]{CommaHigher}[/offset]"
var comma = text.find(",")
if comma:
bbcode_text.comma = templateCommaHigher.format({ "commaHigher" : text })
so this addresses only the comma no matter which other template is already on.
Is that possible?
Look, making lists is currently a chore and we all have a scrapbook filled with "pre-made" lists because of this.
Let's cut the middle and get some opening and closing buttons for making lists and sub list points.
Hi, I saved the bbcode for a language I made while trying the free version -- I wanted to show it to a friend in discord, so I copy/pasted it there, let discord send it as a .txt file, and then downloaded that .txt file today after upgrading to a pro account. I thought it would load and let me re-generate/play around with the same language per this post, but I get an error saying the file is corrupted. It looks perfectly readable to me when I open it so I am guessing the issue is the file format, but I could obviously be wrong. Is there any way for me to import the content of my .txt file and the vocabulary in the .csv and expand this same language with the features in my pro account? Thank you!
Hi everyone,
it appears fairly easy to apply some BbCode to (parts of) a text in a RichTextLabel via the editor's Inspector, like right-aligning [right]{text}[/right].
But what if I don't have any straight text to deal with in the Inspector but rather some yet to be inserted input (by the user) in an empty RichTextLabel? How could I mark certain elements of a text (e. g. entered numbers) to only tweak them?
And I'd like to apply a general right-aligning to the whole RichTextLabel, but as there is no such option to select in the Inspector, isn't there any way to apply this by code within the node's script?
Happy new year everyone,
I managed to bbcode-tweak my RichTextLabel so that the first digit turns blue when a certain number of digits are entered:
var templateWriting = "[right][color=blue]{firstDigit}[/color]{remainingDigits}[/right]"
I can also make, for example, that first digit shake...
"[right][shake rate=15 level=20]{firstDigit}[/shake]{remainingDigits}[/right]"
This all works fine. But I can't have both effects at the same time. I thought that should work like this:"[right][color=blue][shake rate=15 level=20]{firstDigit}[/color][/shake]{remainingDigits}[/right]"
But this doesn't seem to work. How could I achieve this?
--------------------------
However, what my question is aiming for in the first place: how can I have that first digit to be set a little higher than the others? I was wondering if that could be done via "offset", maybe something like [offset = Vector2 (0, 20)]
, but I can't really figure it out. Or maybe this could be done with the RichTextLabel's custom fonts' property "extra_spacing_char
"? Any help is mich appreciated!
(Weirdly enough, setting the shake rate to 0 and the level to e. g. 80 clearly changes the position of the digit (without shaking around, obviously). But there must be a proper way to do this...)
I have a bit of a problem. I want to support my game icons to be displayed as "emojis" in a bbcode text field, as known from many games, especially in nintendo games. My first approach was to go via bbcode and a custom RichTextEffect
but as far as I can tell, the char_fx
argument, you have access to, does not support image drawing. My next step was to use the _draw()
function, by extending the richt text box. The drawing did work fine, but I had troubles to position is to the correct position in the text and make the default features like characters visible/percentage and scrolling work.
The default bbcode does not support texture atlases.
I could split up my atlas into hundrets of small images, but I'd like to avoid this step.
Has anyone of you already implemented this and can give me a hint?
Edit:
Okay, I have a solution that works for now. I will see how the performance will go. This is the script I added to a RichTextLabel
this allows me to write %%icon_...%%
in the bbcode, that gets replace with a the corresponding image, using an atlas instead if single files
tool
extends RichTextLabel
var texture = preload("res://Assets/item_icons.png")
var icon_regions = {
wood = Vector2(0, 0),
stone = Vector2(32, 0),
gold_coin = Vector2(5 * 32, 0),
}
func set_bbcode_with_icon(bbcode):
set_bbcode(bbcode)
var bb_left: String = bbcode
if bb_left.find("%%icon_"):
clear()
while (bb_left.find("%%icon_") >= 0):
var pos = bb_left.find("%%icon_")
var pos_end = bb_left.find("%%", pos + 7) + 2
var icon_name = bb_left.substr(pos + 7, (pos_end - 2) - (pos + 7))
var text_before = bb_left.substr(0, pos)
add_text(text_before)
var region_data = icon_regions.get(icon_name, null)
if region_data != null:
var atlas = AtlasTexture.new()
atlas.atlas = texture
atlas.region = Rect2(region_data.x, region_data.y, 32, 32)
add_image(atlas, 24, 24)
bb_left = bb_left.substr(pos_end)
pass
add_text(bb_left)
func _draw():
set_bbcode_with_icon(get_bbcode())
pass
I have a dialogue system that prints each character to the screen one at a time. The problem is that each time it prints a character it resets the rich text effect timer so that animated bbcode gets reset. It means the animations don't start until the text is all printed out.
Is there any way around the text effect's elapsed_time getting reset every time the bbcode is edited?
screenshot of dialogue: https://imgur.com/a/qzsWvZr
Write a method that accepts a BBCode string and produces HTML. The parser should support at least:
Bold Text
[b]some text[/b]
= <strong>some text</strong>
Italics
[i]some text[/i]
= <em>some text</em>
Underlined
[u]some text[/u]
= <span style="text-decoration: underline;">some text</span>
Hyperlinks
[url=https://example.com]example[/url]
= <a href="https://example.com" target="_blank">example</a>
Bullet Points
[*] Bullet One
[*] Bullet Two
=
<ul>
<li>Bullet One</li>
<li>Bullet Two</li>
</ul>
Additional BBCode can be supported if you so wish.
Congrats to /u/Vusys (me!) for their solution.
Your solution should try to:
The solution should work, although if it has the occasional bug, crash, or other oddies, that's fine. As long as it mostly works.
Hi guys, So out of the sudden while I was writing my articles my BB-code tags suddenly disappeared. Instead of seeing [h2][/h2] I now just see my text enlarged big time. Like it's some kind of preview mode. I'm not sure if there was some kind of update or that I managed to enable some preview mode by accident but I REALLY dislike having to write my articles this way :(
I mean sometimes I just have to write ideas down while being at school and I usually do so in a browser windows smaller than a quarter than my screen. This is just unworkable lmao.
I have this string which is meant to show in a RichTextLabel, centered and with a certain colour.
I am using a custom font
The string is contained in the variable "card"
The text is centered, but it's still white, why does this happen?
$"Card_Body".bbcode_text = ("[center][color=<#F6856E>]%s[/color][/center]") % card
edit: I've added the # I missed originally, though the same problem persists
I started scripting to post the values of a die to the chat after the a die was rolled. It worked fine so far. Now I am searching for a way to dispaly the die value rolled with the color of the die. I could not find a way to convert the color of the die to a bbCode.
self.getColorTint() does not seem to work. I know i have to use r, g, b to get the red , green and blue value but I was thinking that maybe there is a way ot get the # code of an object which is already been implemented if you rightclick the die and select "Color Tint".
I hope someone can help me.
Thx for every response
It seems that the Guide to BBCode Commands page isn't displaying the actual code properly. For many of the examples that they give, the Code: and the Example: just print out the example output and leave out the actual code entirely. Does this happen to anyone else, and if not, is there any other resource or reference for BBCode other than the videos?
I am editing a website that uses BBCode to make posts, and in those posts I want to insert links that are automatically opened in a new tab instead of the same one.
I read this post on a forum and found something useful that I think will solve my problem. However, I need more details because I don't fully understand since my html knowledge is limited.
This picture (from the forum) shows the steps needed to do what I'm looking for:
https://preview.redd.it/0c510sbblo141.png?width=741&format=png&auto=webp&s=5ee0c85d0dd2f08bb7d63ae0abce087da59c948f
I understand the first part (BBCode Usage)
But I do not understand the second and third steps.
Where on the HTML file should I add that?
Hi guys,
I am working on dialogue system in my game. I made a dialogue box with rich text label witch write dialogue line from JSON file.
I want to make typewriter effect that use bbcode special "chars" like "[b]" or ["center"], but i don't know exactly how to do this, because i used to use normal typewriter that does not process special "chars".
I would be very grateful for suggesting an idea how to do this, or maybe ready-made solutions.
P.S. Sorry for my English, I hope you understand what I mean :)
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.