Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import MarkdownIt from 'markdown-it'
import slugify from 'slugify'
import Renderer from './jsxRenderer'
import importsToCommonJS from './importsToCommonJS'
import jsx_inline from './jsx_inline'
import jsx_block from './jsx_block'
import text_with_newline from './text_with_newline'
slugify.extend({
'>': '',
'<': '',
'`': '',
})
const DEFAULT_FACTORIES = {
'wrapper': 'createFactory(\'div\')',
'codeBlock': '(props, children) => createElement("pre", props, createElement("code", { dangerouslySetInnerHTML: { __html: children || props.children } }))'
}
function mdJSX(md) {
// JSX should entirely replace embedded HTML.
md.inline.ruler.before('text', 'text_with_newline', text_with_newline);
md.inline.ruler.before('html_inline', 'jsx_inline', jsx_inline);
export function normalizeSlug (slug) {
if (!slug) return
// Remove certain replacements mapped by slugify
slugify.extend({
'|': null,
'%': null,
$: null
})
const slugified = slugify(slug, {
replacement: '-',
remove: /[*+=~.,<>(){}'"!?:;@#$%^&*|\\/[\]]/g,
lower: true
})
// Remove any trailing or leading hyphens, which slugify doesn't clean up
return slugified.replace(/^[-]+|[-]+$/g, '')
}
const slugify = require('slugify');
slugify.extend({ '/': '-' });
//Some weired phone brands with weired browser features support
const fuckedBrands = [];
//some UA related utilities, and some simple device check
exports.normalizeUA = function normalizeUA(ua) {
return String(ua || '').toLowerCase();
};
exports.isFuckedPhone = function isFuckedPhone(ua) {
ua = this.normalizeUA(ua);
for (const phone of fuckedBrands) {
if (ua.indexOf(phone) >= 0) {
return true;
}
export function getSlugifiedShortname(tracker_name: string): string {
slugify.extend({
"+": "_",
".": "_",
"~": "_",
"(": "_",
")": "_",
"!": "_",
":": "_",
"@": "_",
'"': "_",
"'": "_",
"*": "_",
"©": "_",
"®": "_",
"<": "_",
">": "_",
"-": "_",
slugifyProjectShortName(value: string): void {
if (this.has_error || this.is_in_edit_mode) {
return;
}
this.has_slug_error = false;
this.project_name = value;
slugify.extend({
"+": "-",
".": "-",
"~": "-",
"(": "-",
")": "-",
"!": "-",
":": "-",
"@": "-",
'"': "-",
"'": "-",
"*": "-",
"©": "-",
"®": "-",
});
this.slugified_project_name = slugify(value, { lower: true }).slice(
0,
const slugify = require('slugify');
slugify.extend({
"$": "",
"%": "",
"&": "",
"<": "",
">": "",
"|": "",
"¢": "",
"£": "",
"¤": "",
"¥": "",
"₠": "",
"₢": "",
"₣": "",
"₤": "",
"₥": "",
"₦": "",