All Projects → lovell → Limax

lovell / Limax

Licence: apache-2.0
Node.js module to generate URL slugs. Another one? This one cares about i18n and transliterates non-Latin scripts to conform to the RFC3986 standard. Mostly API-compatible with similar modules.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Limax

Urlify
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.
Stars: ✭ 633 (+49.65%)
Mutual labels:  seo, transliteration, slug
React Next Boilerplate
🚀 A basis for reducing the configuration of your projects with nextJS, best development practices and popular libraries in the developer community.
Stars: ✭ 129 (-69.5%)
Mutual labels:  i18n, seo
Pimcore I18n
Pimcore - i18n Manager
Stars: ✭ 19 (-95.51%)
Mutual labels:  i18n, seo
django-slugs-example-app
A basic app to show how to add slugs to models
Stars: ✭ 12 (-97.16%)
Mutual labels:  url, seo
Slugger
A Slugger for elixir.
Stars: ✭ 149 (-64.78%)
Mutual labels:  url, slug
Prestashop Clean Urls
Prestashop module. This override module allows to remove IDs from URLs
Stars: ✭ 87 (-79.43%)
Mutual labels:  seo, url
Polyglot
🔤 Multilingual and i18n support tool for Jekyll Blogs
Stars: ✭ 242 (-42.79%)
Mutual labels:  i18n, seo
Speakingurl
Generate a slug – transliteration with a lot of options
Stars: ✭ 1,056 (+149.65%)
Mutual labels:  transliteration, slug
example-app
Example app showcasing fulls1z3's Angular libraries
Stars: ✭ 27 (-93.62%)
Mutual labels:  i18n, seo
mongoose-slug-updater
Schema-based slug plugin for Mongoose - single/compound - unique over collection/group - nested docs/arrays - relative/abs paths - sync on change: create/save/update/updateOne/updateMany/findOneAndUpdate tracked - $set operator - counter/shortId
Stars: ✭ 37 (-91.25%)
Mutual labels:  url, slug
Omeka-plugin-CleanUrl
Omeka plugin that allows to have clean, searchable and readable URL like https://example.com/my_collection/dc:identifier instead of https://example.com/items/show/internal_code.
Stars: ✭ 13 (-96.93%)
Mutual labels:  url, seo
Hanbaobao
Mandarin Chinese text segmentation and mobile dictionary Android app (中文分词)
Stars: ✭ 17 (-95.98%)
Mutual labels:  pinyin, transliteration
mongoose-slug-plugin
Slugs for Mongoose with history and i18n support (uses speakingurl by default, but you can use any slug library such as limax, slugify, mollusc, or slugme)
Stars: ✭ 21 (-95.04%)
Mutual labels:  seo, slug
Universal
Seed project for Angular Universal apps featuring Server-Side Rendering (SSR), Webpack, CLI scaffolding, dev/prod modes, AoT compilation, HMR, SCSS compilation, lazy loading, config, cache, i18n, SEO, and TSLint/codelyzer
Stars: ✭ 669 (+58.16%)
Mutual labels:  i18n, seo
Slugify
Slugify a string
Stars: ✭ 2,110 (+398.82%)
Mutual labels:  transliteration, slug
Vuesion
Vuesion is a boilerplate that helps product teams build faster than ever with fewer headaches and modern best practices across engineering & design.
Stars: ✭ 2,510 (+493.38%)
Mutual labels:  i18n, seo
Slug Generator
Slug Generator Library for PHP, based on Unicode’s CLDR data
Stars: ✭ 740 (+74.94%)
Mutual labels:  transliteration, slug
Slugify Cli
Slugify a string
Stars: ✭ 49 (-88.42%)
Mutual labels:  transliteration, slug
universal-react-starter-kit
Universal React Starter Kit is an universal web application framework using koa, react, redux and webpack.
Stars: ✭ 13 (-96.93%)
Mutual labels:  i18n, seo
seourls
phpBB Extension: URL rewriting for phpBB forums
Stars: ✭ 44 (-89.6%)
Mutual labels:  url, seo

limax

(Yet another) Node.js module to generate URL slugs, also known as clean URLs, user-friendly URLs and SEO-friendly URLs.

The difference?

This module extends the fantastic speakingurl module to include Romanisation of Chinese and Japanese scripts.

Give it a string of text in pretty much any major world language and it will convert it to valid characters, conforming to RFC3986, for use within the path element of a URL.

Currently supports, but not limited to, the following scripts:

  • Latin: e.g. English, français, Deutsch, español, português
  • Cyrillic: e.g. Русский язык, български език, українська мова
  • Chinese: e.g. 官话, 吴语 (converts to Latin script using Pinyin with optional tone number)
  • Japanese: e.g. ひらがな, カタカナ (converts to Romaji using Hepburn)

If you already use either the speakingurl or slug modules, you can probably swap in limax without changing the logic in your code.

Oh, and limax is the Latin word for slug.

Install

npm install limax

Usage

import slug from 'limax';

slug(text)

const latin = slug('i ♥ latin'); // i-love-latin
const cyrillic = slug('Я люблю русский'); // ya-lyublyu-russkij
const pinyin = slug('我爱官话'); // wo3-ai4-guan1-hua4
const romaji = slug('私は ひらがな が大好き'); // ha-hiragana-gaki

slug(text, options)

options:

  • replacement: String to replace whitespace with, defaults to - (provides API compatibility with the slug module)
  • separator: String, equivalent to replacement (provides API compatibility with the speakingurl module)
  • lang: String, ISO 639-1 two-letter language code, defaults to auto-detected language
  • tone: Boolean, add tone numbers to Pinyin transliteration of Chinese, defaults to true
  • separateNumbers: Boolean, separate numbers that are within a word, defaults to false
  • separateApostrophes: Boolean, separate apostrophes that are within a word, defaults to false
  • maintainCase: Boolean, maintain the original string's casing, defaults to false
  • custom:
    • Object, custom map for translation, overwrites all i.e. { '&': '#', '*': ' star ' }
    • Array, add chars to allowed charMap
const strich = slug('Ich ♥ Deutsch', {lang: 'de'}); // ich-liebe-deutsch
const unterstreichen1 = slug('Ich ♥ Deutsch', {lang: 'de', replacement: '_'}); // i_liebe_deutsch
const unterstreichen2 = slug('Ich ♥ Deutsch', {lang: 'de', separator: '_'}); // i_liebe_deutsch
const wuYin = slug('弄堂里的菜品赤醬', {tone: false}); // nong-tang-li-di-cai-pin-chi-jiang

// separateNumbers example
const numbersInWord = slug('hello2world'); // hello2world
const numbersSeparated = slug('hello2world', { separateNumbers: true }); // hello-2-world

// separateApostrophes example
const apostrophesInWord = slug('j\'aime'); // jaime
const apostrophesSeparated = slug('j\'aime', { separateApostrophes: true }); // j-aime

// maintainCase example
const caseNotMaintained = slug('HelloWorld'); // helloworld
const caseMaintained = slug('HelloWorld', { maintainCase: true }); // HelloWorld

// custom example
const custom1 = slug('hello.world', { custom: ['.'] }); // hello.world
const custom2 = slug('hello-*-world', { custom: { '*': 'asterisk' } }); // hello-asterisk-world

slug(text, replacement)

Provided to support backwards-compatibility with the slug module.

const underscore = slug('i ♥ unicode', '_'); // i_love_unicode

Test .github/workflows/ci.yml

Run the unit tests with:

npm test

Contribute

Pull requests with mappings and tests for further scripts and languages are more than welcome.

Licence

Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Lovell Fuller and contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].