1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/wizard/lib/text-lite.js.es6
Faizaan Gagan 0205d8ccb5
fixed linting issues for javascripts/wizard folder (#94)
* ran eslint and fixes linting issues for javascripts/wizard folder

* ran prettier
2021-04-12 11:56:22 +05:30

19 Zeilen
615 B
JavaScript

import loadScript from "./load-script";
import { default as PrettyText } from "pretty-text/pretty-text";
import Handlebars from "handlebars";
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));
}
}