foundation / style-sherpa

A simple style guide generator.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variable "anchor" no work to russian language

nefeloget opened this issue · comments

Problems in code:
var anchor = title.toLowerCase().replace(/[^\w]+/g, '-');

Solution:
var anchor = title.toLowerCase().replace(/[^A-Za-z0-9_А-Яа-яЁё]+/g, '-');
or
var anchor = title.toLowerCase().replace(/\ /g, '-');

Anyway currently works only with Latin characters, which is bad.

Variables / code which use non-latin characters are an anti-pattern that you should avoid.

If we would have to support every language we would have to adjust the regex. That makes not much sense.