From f0c365dca8edc8f66a4bf9bba159ce07bed48a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ord=C3=A1s?= <3125580+davorpa@users.noreply.github.com> Date: Fri, 11 Feb 2022 23:14:07 +0100 Subject: [PATCH] strip LTM and RTM entities when normalize text To support bidirectional text alphabetization (https://en.wikipedia.org/wiki/Bidirectional_text) Via https://github.com/EbookFoundation/free-programming-books/issues/6714 --- lib/alphabetical-list-items.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/alphabetical-list-items.js b/lib/alphabetical-list-items.js index 661d1e0..f56de85 100644 --- a/lib/alphabetical-list-items.js +++ b/lib/alphabetical-list-items.js @@ -3,8 +3,8 @@ const visit = require('unist-util-visit'); const toString = require('mdast-util-to-string'); function normalize(text) { - const removeAtBeginning = /^([-._(《"'])*/; - const removeInside = /[,:]/; + const removeAtBeginning = /^([-._(《"'\u200e\u200f])*/; + const removeInside = /[,:\u200e\u200f]/; const replaceWithSpace = /-/; return text.toLowerCase() .trim()