How to use the slugify.extend function in slugify

To help you get started, we’ve selected a few slugify 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 frontarm / mdx-util / deprecated-packages / mdxc / src / mdxc.js View on Github external
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);
github streetmix / streetmix / assets / scripts / util / helpers.js View on Github external
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, '')
}
github JasonBoy / koa-web-kit / utils / common.js View on Github external
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;
    }
github Enalean / tuleap / plugins / tracker / scripts / tracker-creation / src / helpers / shortname-slugifier.ts View on Github external
export function getSlugifiedShortname(tracker_name: string): string {
    slugify.extend({
        "+": "_",
        ".": "_",
        "~": "_",
        "(": "_",
        ")": "_",
        "!": "_",
        ":": "_",
        "@": "_",
        '"': "_",
        "'": "_",
        "*": "_",
        "©": "_",
        "®": "_",
        "<": "_",
        ">": "_",
        "-": "_",
github Enalean / tuleap / src / scripts / project / registration / src / components / Information / Input / ProjectShortName.vue View on Github external
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,
github EasyCorp / EasyAdminBundle / assets / js / form-type-slug.js View on Github external
const slugify = require('slugify');
slugify.extend({
    "$": "",
    "%": "",
    "&": "",
    "<": "",
    ">": "",
    "|": "",
    "¢": "",
    "£": "",
    "¤": "",
    "¥": "",
    "₠": "",
    "₢": "",
    "₣": "",
    "₤": "",
    "₥": "",
    "₦": "",

slugify

Slugifies a String

MIT
Latest version published 2 years ago

Package Health Score

82 / 100
Full package analysis