Actually I thought about it and the syntax highlighting is only triggered during preview and the first time the page is loaded, that's probably why it doesn't re-run the syntax highlighting when a new post is added. I'll see what I can do about it.

    I published a new version of the library with a new workaround for the Blink issue and a new version of the [code] BBCode that should trigger highlighting even when the content is added to the page via JavaScript DOM manipulation.

    I think the beta demo has already picked it up because all of the syntax highlighting worked on Chrome when I tested it. I haven't tried with Firefox but I expect it to work fine.

      tankerkiller125 it's safer to run composer update with some more arguments in order to not update everything at once. I believe you could do something like (written out of the top of my head, untested) composer update s9e/text-formatter to update just the text formatter, or composer update flarum/core --with-all-dependencies to update core and all its dependencies.

      Running update without arguments will also update all extensions immediately and could make it harder to debug an issue if something breaks after the command.

        5 days later

        clarkwinkelmann I believe you could do something like (written out of the top of my head, untested) composer update s9e/text-formatter to update just the text formatter.

        Tested, works!

        6 days later

        Littlegolden JoshyPHP This method seems doesn't work in Flarum-beta.12.

        It does work. I changed my theme to 'default'. Originally it was the GitHub theme. The thing is Flarum works well only with the default theme because half the theme's css is inbuilt in the site itself (like the beckground color of <pre> and all that). I've been trying to make an extension to allow other themes but haven't been that successful plus I'm short on time. So if you try changing it to a theme like 'dracula', you'll get some of the text having the dracula theme and some having the default theme.

        JoshyPHP i'm working on the Diff extension and need to show rendered post in a modal. Full post content lies in db (not the xml version) and i'm simply rendering it using render() after parsing but code highlighting is not working as expected. Is there anything i can do to solve it? Any suggestions?

          Kylo Make sure you have updated your dependencies recently and check your browser's console for errors. If that doesn't work, post the HTML here.

          Also note that depending on how you insert the post's HTML in the page, browsers may not execute scripts.

            JoshyPHP whops, I thought I've updated 😅 v2.3.7 did the magic.

            JoshyPHP that should trigger highlighting even when the content is added to the page via JavaScript DOM manipulation

            Okay I need to learn it, I've taken a look at the code and I don't really understand. Is there a way for extensions which are using custom BBCodes to achive this?

            I don't know what you mean. If your extension used innerHTML to insert scripts, you need to use something else. I think that Flarum uses Mithril.js but I don't know anything about it. You should create a new thread for it, Flarum probably already has an API for displaying posts.