0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-20 15:51:11 +02:00
discourse-custom-wizard/assets/javascripts/wizard/lib/text-lite.js.es6
2018-02-08 12:30:55 +08:00

18 Zeilen
574 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));
}
}