Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-15 22:32:54 +01:00
cf50a7deb3
* Apply prettier * applied prettier for similar-topics-validator Co-authored-by: Faizaan Gagan <fzngagan@gmail.com>
18 Zeilen
578 B
JavaScript
18 Zeilen
578 B
JavaScript
import loadScript from "./load-script";
|
|
import { default as PrettyText } from "pretty-text/pretty-text";
|
|
|
|
export function cook(text, options) {
|
|
return new Handlebars.SafeString(new PrettyText(options).cook(text));
|
|
}
|
|
|
|
// everything should eventually move to async API and this should be renamed
|
|
// cook
|
|
export function cookAsync(text, options) {
|
|
if (Discourse.MarkdownItURL) {
|
|
return loadScript(Discourse.MarkdownItURL)
|
|
.then(() => cook(text, options))
|
|
.catch((e) => Ember.Logger.error(e));
|
|
} else {
|
|
return Ember.RSVP.Promise.resolve(cook(text));
|
|
}
|
|
}
|