getgrav / grav-plugin-anchors

Grav Anchors Plugin
https://getgrav.org
MIT License
11 stars 7 forks source link

Swedish special chars #16

Open nozense opened 6 years ago

nozense commented 6 years ago

Disclaimer: i know nothing of JS, very little about Grav and less about github (=

Found that i had some problems with the swedish special chars "Å Ä Ö" in the anchor links and the auto-generated menu.

Solved this by adding

'å','ä',

to the "$rx1 = array" of AnchorsTwigExtension.php

and adding

.replace(/å/g, '').replace(/Å/g, '').replace(/ä/g, '').replace(/Ä/g, '').replace(/ö/g, '').replace(/Ö/g, '')

just before .toLowerCase() in anchors.min.js

Is this me not using the plugin the right way or is there a need for updates similar to the above?

Did not make a pull-request because i'm not sure how to actually do it and almost certain there is a better way to do these changes.

ghost commented 5 years ago

This problem also exists with german special characters. I solved this by commenting out the special character array $rx1 in AnchorsTwigExtension.php and used an empty array instead: $rx1 = array();