const Model = require('objection').Model const _ = require('lodash') const JSBinType = require('js-binary').Type const pageHelper = require('../helpers/page') const path = require('path') const fs = require('fs-extra') const yaml = require('js-yaml') const striptags = require('striptags') const emojiRegex = require('emoji-regex') const he = require('he') const CleanCSS = require('clean-css') const TurndownService = require('turndown') const turndownPluginGfm = require('@joplin/turndown-plugin-gfm').gfm const cheerio = require('cheerio') const pageRegex = /^[a-zA0-90-9-_/]*$/ const frontmatterRegex = { html: /^()?(?:\n|\r)*([\w\W]*)*/, legacy: /^(