Discourse markdown extensions not working after latest Discourse upgrade

  • This issue has happened right after the latest upgrade to v3.3.0.beta1-dev — ac53e5a962 — Ember v5.5.0.
  • Link to my custom plugin’s markdown extension rule: assets/javascripts/lib/discourse-markdown/snippets.js.es6 · master · Text Blaze / Discourse Snippets · GitLab (unchanged since almost an year)
  • Older posts with this extension are still rendered correctly. But, doing “Rebuild HTML” on any old post will break it.
  • Link to example post with the issue: link
  • I believe the issue is not related to the plugin, as the plugin is unchanged, and the extension works fine when drafting the post.
  • Is there anything specific in this latest Discourse upgrade that can cause this issue?

Description: I have a custom plugin that uses markdown extensions (as described here). The plugin works when drafting a post/topic - showing the HTML preview. But, when the post/topic is posted, the plugin simply has no effect. The raw post contents are preserved as it is.

Screenshot: works while drafting

Screenshot: raw code after posting

There are no (relevant) errors in the DevTools or in the forum /logs endpoint.

1 Like

Hi @merefield , thanks for your response. Sorry about the confusing wording of my original topic. The issue is with my custom plugin that uses Discourse’s Markdown extensions. I have now edited my original post to reflect that.

1 Like

Ah! Probably I misread too, thanks for clarifying!

1 Like

This plugin may have several issues.

These are the ones that pop up on the console:

One of them refers to a removal in 2.7.0!!

Are you the maintainer of this plugin? If so I think you have some work to do :slight_smile:

Yup, I am the maintainer :slightly_smiling_face: Though, I don’t feel these two warnings are related to the current issue. The whiteList method is still available in the latest discourse. And the other deprecation is related to a toolbar entry in the GUI, not the actual markdown extension. At least, that’s my thought.

I will still push an update to handle the deprecations. I will also mention that the plugin was working fine until the previous release.

1 Like

It’s still working though?

What appears to be missing is any CSS to style it?

image

Thanks for the report @GaurangBlaze. Looks like a recent refactoring broke support for .js.es6 files in the server-side markdown cooking. We’ll get it fixed up in the next few days.

In the meantime, removing the .es6 extension from your JS files should resolve the problem. That’s a good thing to do anyway - there is no longer any need for it, and using the standard .js makes for much better IDE/editor support.

6 Likes

Oh yes … this must have happened very recently (last 4 days!) Just updated my dev instance and can finally repro … apologies!

1 Like

Yup I think it was probably DEV: Remove sprockets from plugin 'extra js' pipeline (#25502) · discourse/discourse@1757a68 · GitHub (4 days ago)

1 Like

Thanks @david and @merefield for the help! That was indeed my issue and it is all working now :slightly_smiling_face:

2 Likes

Core behaviour has been fixed in FIX: Restore support for `.js.es6` files in PrettyText (#25588) · discourse/discourse@dea753a · GitHub

(but still, I recommend keeping the .js extension. We will eventually deprecate the use of .es6)

2 Likes

Thanks. I didn’t find the .es6 deprecation in the /logs page of our community. Do you plan to put this deprecation there (and other similar deprecations also)?

2 Likes

We haven’t deprecated it yet, so this issue was a bug. But yes, if/when we do deprecate it, the message would be in /logs :+1:

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.