Add support for accent characters

Created on 4 June 2024, 7 months ago
Updated 30 August 2024, 4 months ago

Hello there!

Instead of replacing all characters that don't match the .replace(/[^a-z0-9]/ig, ' ') in toc_js.js with dashes, it would be nice to allow users to define a list of characters and what to replace them with.

I had this issue and made just a quick fix to the code (no UI) in the toc_js.js, I replaced the line 42:
var candidateId = $(heading).text().replace(/[^a-z0-9]/ig, ' ').replace(/\s+/g, '-').toLowerCase();

with:

var candidateId = $(heading).text()   
    .replace(/[àáâãäå]/ig,"a")
    .replace(/[èéêë]/ig,"e")
    .replace(/[óòôö]/ig,"o")
    .replace(/[^a-z0-9]/ig, ' ')
    .replace(/\s+/g, '-').toLowerCase();

But ye, having option to add these additional replacement patterns in UI would be awesome!

Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

🇫🇮Finland phonkala

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024