Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

@keegangeorge
Copy link
Member

As of discourse/discourse@ea1473e, the regex for detecting image markdown is now available as an exported const in discourse/lib/uploads. We don't need to recreate it here as in our own utility file, instead we can simply import from core.

import { IMAGE_MARKDOWN_REGEX } from "discourse/lib/uploads";

This PR removes the declaration in the plugin utilities file for IMAGE_MARKDOWN_REGEX and updates instances in the codebase to import from the core utility.

Copy link
Contributor

@pmusaraj pmusaraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a compatibility entry though, because it'll break if plugin is used with core earlier than the commit that introduces the import.

@keegangeorge
Copy link
Member Author

@pmusaraj: I should've mentioned this in the PR description for clarity, but I think there's already a recently added compatibility entry that should cover this right?

< 3.4.0.beta3-dev: ecf1bb49d737ea15308400f22f89d1d1e71d13d

@pmusaraj
Copy link
Contributor

Yeah, that mostly covers this, but technically you should update that line to point to a commit in core from today, one that has the new import.

@keegangeorge
Copy link
Member Author

@pmusaraj Oh I think I'm misunderstanding, is the commit hash in reference to the plugin commit or a core commit? My understanding was the commit hash is the plugin and the version is the core version. So anyone on core older than 3.4.0.beta3-dev will point to ecf1bb49d737ea15308400f22f89d1d1e71d13d version of the Discourse AI plugin?

@pmusaraj
Copy link
Contributor

Yes, you're right, it's the plugin commit hash, so that does make sense for this. Thanks for fixing the typo though @keegangeorge.

@keegangeorge keegangeorge merged commit 712a07c into main Oct 21, 2024
5 checks passed
@keegangeorge keegangeorge deleted the import-md-regex branch October 21, 2024 21:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants