How to use @tryghost/html-to-mobiledoc - 2 common examples

To help you get started, we’ve selected a few @tryghost/html-to-mobiledoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chadly / ghost / core / server / lib / mobiledoc / converters / index.js View on Github external
get htmlToMobiledocConverter() {
        try {
            return require('@tryghost/html-to-mobiledoc').toMobiledoc;
        } catch (err) {
            if (process.versions.node.startsWith('v6.')) {
                // NOTE: When Node v6 is dropped this code block should be removed
                return () => {
                    throw new common.errors.InternalServerError({
                        message: 'Unable to convert from source HTML to Mobiledoc',
                        context: 'The html-to-mobiledoc package was not installed',
                        help: 'Please upgrade to Node.js v10',
                        code: 'HTML_TO_MOBILEDOC_INSTALLATION',
                        err: err
                    });
                };
            } else {
                return () => {
                    throw new common.errors.InternalServerError({
                        message: 'Unable to convert from source HTML to Mobiledoc',
github TryGhost / Ghost / core / server / lib / mobiledoc / converters / index.js View on Github external
get htmlToMobiledocConverter() {
        try {
            return require('@tryghost/html-to-mobiledoc').toMobiledoc;
        } catch (err) {
            return () => {
                throw new common.errors.InternalServerError({
                    message: 'Unable to convert from source HTML to Mobiledoc',
                    context: 'The html-to-mobiledoc package was not installed',
                    help: 'Please review any errors from the install process by checking the Ghost logs',
                    code: 'HTML_TO_MOBILEDOC_INSTALLATION',
                    err: err
                });
            };
        }
    }
};

@tryghost/html-to-mobiledoc

Convert HTML strings into Mobiledoc objects.

MIT
Latest version published 16 days ago

Package Health Score

63 / 100
Full package analysis

Popular @tryghost/html-to-mobiledoc functions

Similar packages