Replies: 2 comments
-
|
Hello! It's a welcome surprise to see someone also on the same path as us. I'm honored to hear your support! You're welcome to make a fork of the repo and change it to however you need. We're also welcome to discussion but do note that we intended this plugin to be a custom dedicated plugin for our forum. If you have questions or want to discuss some possible features, you're more than welcome to give us a ping, but we cant guarantee we'll be able to fully accommodate this plugin repo to your needs. Similarly, I don't see a way to generalize the plugin to make custom bbcode configurable by an admin (I'll discuss more on this later). However I can give a brief overview of this new plugin to help you get an understanding of this plugin. With this new plugin, we plan on hijacking the cook function that discourse performs. The markdown-it engine just simply isn't designed to handle any extensive bbcode, and we ended up poking a TON of holes in it with the old plugin to get it to a state we can wrap up the plugin as complete. Even now, we plan on only using it as a backup. That brings us to our new plugin and approach. We take another well running bbcode engine (BBob) and create our custom bbcode for it. We then bundle the whole thing into a single js file that gets initialized during the cook initialization. We hijack the cook function to forcefully include a call to our bundle js right before the call to markdown-it. This lets us generate our own HTML before it markdown-it can mess with it. Then with a healthy amount of allow-lists in the markdown-it plugin to accept our HTML, we let markdown-it run. This lets us also use markdown at the same time. In order for all this to happen, we need it to occur on both the client and server side. Client side is easy enough and requires no further modification. Server side requires us both add the bundle js as a js asset and forcefully reset the js context in the server to load it in. We do this when the plugin is first added to the discourse instance and every time it is updated (hopefully). Because we have to declare the files to attach to the js context ahead of time, we bundle it into a single file during dev and attach it at plugin. In order to generalize the plugin to be able to take in custom bbcode from an admin interface, we'd need to find a way to attach novel js code into server side js context, which I don't think is possible. As such, we plan on adding all of our unique bbcode directly into the plugin itself. We're currently at an early stage where we can begin adding new custom BBCode to the plugin, and also update and improve the integration with discourse and markdown-it. I'll prob add some issues to github, but a current minor issue we're having deals more with BBob than the plugin. BBob doesn't support case-insensitive bbcode tag names. I'm thinking we can either put a PR on BBob to add a case-insensitive mode for the allowed tags function, or we remove the allowed tags mode and make a bbob plugin to process the tag names. Both are kinda involved and honestly I'm not sure how it'd reflect on performance. I'm leaning towards the first. Open to thoughts and suggestions. Anyway, welcome to the community! |
Beta Was this translation helpful? Give feedback.
-
|
Thank you! The main thing that may be unique to my forum was that I was planning on repurposing the tag functionality of discourse to use as formatting flags as opposed to topic organizers. --- [tangent] --- Which modifies the functional Discourse Gifs plugin to where it injects the word "spider-man" into any gif query and only on topics with the "spider-man" tag applied. (you can see it in action at https://beagle-time.com/t/only-talk-about-spider-man/25/27) The idea being that forum comics often benefit from different formatting, and the tag system could allow custom logic to be applied on a per-thread basis. (with the downside being each new tag feature requires its own set of tests which could get bloated if the forum ends up having too many unique tag plugins). I don't see this affecting a bbcode plugin, but it could be something to think about for RPNation in the future as well. Really though, I'm not too worried about forum-specific stuff at the moment. I figure that any functionality differences can be resolved by forking the code, as you said. Also, considering that any/most bbcode additional tags have to be added on as a server-side plugin anyway, people adding custom bbcode would likely expect needing to add or modify a plugin. Although there may be a way to set a flag that enable/disable's the code from the admin menu... I do have one question, but I will make it another topic, because it may be a project all on its own. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I've been working on discourse for a month or so to plan for a possible migration of another forum (more a collaborative comic forum than a RolePlay one, but there's a lot of overlap in the importance of having functioning bbcode for post formatting). I found the original RPNation bbcode plugin while searching through the discourse meta and I really appreciated seeing the legwork you had done to get that functioning.
I'd be happy to help get this new plugin working and to add features. Let me know what you'd like me to work on and I'll see what I can do!
I'll check here, and you can also find me on discord as btp.
Beta Was this translation helpful? Give feedback.
All reactions