Creating Parsing Extensions

Hello,
I want to make a parsing extension for Discourse which would change text like say [Hello World!] to scratchblocks and many other images of this type. Do I need to make any changes to the existing Discourse files or can I just start writing code without making any changes to the existing files.

2 Likes

Hey and welcome to Meta @R4356th :wave:

No, making changes to Discourse files on your server (in this context) means that you’ll either be unable to update your site or that your changes will be wiped with the next update.

The way to approach this is to either create a plugin or a theme / theme component.

Those are the methods your can use to extend Discourse to match your needs.

For your particular feature, you’ll need a plugin. I recommend taking a look at the source code of the bbcode plugin for inspiration.

5 Likes

Thank you very much this should help.

3 Likes

Is it to write the parser in PHP?

You might want to look at Developer's guide to Markdown extensions

(In general FYI all Discourse extensions are written in EmberJS and Rails, but you will only need JavaScript here I expect)

4 Likes

Thank you. :blush:

2 Likes