DEV: Add debug hint in discourse-markdown-it

This console.debug message ONLY shows if isDevelopment() is
true for the environment
This commit is contained in:
Martin Brennan 2020-07-15 11:18:41 +10:00
parent 8515bdf1d8
commit 5a4855b992
No known key found for this signature in database
GPG Key ID: A08063EEF3EA26A4
1 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import WhiteLister from "pretty-text/white-lister"; import WhiteLister from "pretty-text/white-lister";
import { isDevelopment } from "discourse-common/config/environment";
import { sanitize } from "pretty-text/sanitizer"; import { sanitize } from "pretty-text/sanitizer";
import guid from "pretty-text/guid"; import guid from "pretty-text/guid";
@ -372,6 +373,15 @@ export function setup(opts, siteSettings, state) {
setupInlineBBCode(opts.engine); setupInlineBBCode(opts.engine);
setupTextPostProcessRuler(opts.engine); setupTextPostProcessRuler(opts.engine);
if (isDevelopment()) {
if (window.console) {
// eslint-disable-next-line no-console
console.debug(
"DEBUG: To debug all markdown plugins, add console.log within pluginCallbacks.forEach."
);
}
}
pluginCallbacks.forEach(([feature, callback]) => { pluginCallbacks.forEach(([feature, callback]) => {
if (opts.discourse.features[feature]) { if (opts.discourse.features[feature]) {
opts.engine.use(callback); opts.engine.use(callback);